package binimport ()// Buffer implements low level binary (de-)serialization for TL.typeBufferstruct {Buf []byte}// Encode wrapper.func ( *Buffer) ( Encoder) error {return .Encode()}// Decode wrapper.func ( *Buffer) ( Decoder) error {return .Decode()}// ResetN resets buffer and expands it to fit n bytes.func ( *Buffer) ( int) { .Buf = append(.Buf[:0], make([]byte, )...)}// Expand expands buffer to add n bytes.func ( *Buffer) ( int) { .Buf = append(.Buf, make([]byte, )...)}// Skip moves cursor for next n bytes.func ( *Buffer) ( int) { .Buf = .Buf[:]}// Read implements io.Reader.func ( *Buffer) ( []byte) ( int, error) {iflen() == 0 {return0, nil }iflen(.Buf) == 0 {return0, io.EOF } = copy(, .Buf) .Buf = .Buf[:]return , nil}// Copy returns new copy of buffer.func ( *Buffer) () []byte {returnappend([]byte{}, .Buf...)}// Raw returns internal byte slice.func ( Buffer) () []byte {return .Buf}// Len returns length of internal buffer.func ( Buffer) () int {returnlen(.Buf)}// ResetTo sets internal buffer exactly to provided value.//// Buffer will retain buf, so user should not modify or read it// concurrently.func ( *Buffer) ( []byte) { .Buf = }
The pages are generated with Goldsv0.6.7. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.