Documentation ¶
Index ¶
- func MarshalBinary(object interface{ ... }) ([]byte, error)
- func MustSize32FromBytes(b []byte) uint32
- func ReadBool(r io.Reader) (bool, error)
- func ReadByte(r io.Reader) (byte, error)
- func ReadBytes(r io.Reader) ([]byte, error)
- func ReadFromBytes[T any](rr *Reader, fromBytes func([]byte) (T, error)) (ret T)
- func ReadInt16(r io.Reader) (int16, error)
- func ReadInt32(r io.Reader) (int32, error)
- func ReadInt64(r io.Reader) (int64, error)
- func ReadInt8(r io.Reader) (int8, error)
- func ReadMarshaled(r io.Reader, val encoding.BinaryUnmarshaler) error
- func ReadN(r io.Reader, data []byte) error
- func ReadSize32(r io.Reader) (uint32, error)
- func ReadString(r io.Reader) (string, error)
- func ReadUint16(r io.Reader) (uint16, error)
- func ReadUint32(r io.Reader) (uint32, error)
- func ReadUint64(r io.Reader) (uint64, error)
- func ReadUint8(r io.Reader) (uint8, error)
- func ReaderFromBytes[T interface{ ... }](data []byte, object T) (T, error)
- func Size32FromBytes(buf []byte) (uint32, error)
- func Size32ToBytes(s uint32) []byte
- func UnmarshalBinary[T interface{ ... }](data []byte, object T) error
- func WriteBool(w io.Writer, cond bool) error
- func WriteByte(w io.Writer, val byte) error
- func WriteBytes(w io.Writer, data []byte) error
- func WriteInt16(w io.Writer, val int16) error
- func WriteInt32(w io.Writer, val int32) error
- func WriteInt64(w io.Writer, val int64) error
- func WriteInt8(w io.Writer, val int8) error
- func WriteMarshaled(w io.Writer, val encoding.BinaryMarshaler) error
- func WriteN(w io.Writer, data []byte) error
- func WriteSize32(w io.Writer, value uint32) error
- func WriteString(w io.Writer, str string) error
- func WriteUint16(w io.Writer, val uint16) error
- func WriteUint32(w io.Writer, val uint32) error
- func WriteUint64(w io.Writer, val uint64) error
- func WriteUint8(w io.Writer, val uint8) error
- func WriterToBytes(object interface{ ... }) []byte
- type Counter
- type Kind
- type PushBack
- type Reader
- func (rr *Reader) PushBack() *Writer
- func (rr *Reader) Read(reader interface{ ... })
- func (rr *Reader) ReadBool() (ret bool)
- func (rr *Reader) ReadByte() (ret byte)
- func (rr *Reader) ReadBytes() (ret []byte)
- func (rr *Reader) ReadDuration() (ret time.Duration)
- func (rr *Reader) ReadInt16() (ret int16)
- func (rr *Reader) ReadInt32() (ret int32)
- func (rr *Reader) ReadInt64() (ret int64)
- func (rr *Reader) ReadInt8() (ret int8)
- func (rr *Reader) ReadKind() Kind
- func (rr *Reader) ReadKindAndVerify(expectedKind Kind)
- func (rr *Reader) ReadMarshaled(m encoding.BinaryUnmarshaler)
- func (rr *Reader) ReadN(ret []byte)
- func (rr *Reader) ReadSerialized(s deserializable)
- func (rr *Reader) ReadSize16() (ret int)
- func (rr *Reader) ReadSize32() (ret int)
- func (rr *Reader) ReadSizeWithLimit(limit uint32) int
- func (rr *Reader) ReadString() (ret string)
- func (rr *Reader) ReadUint16() (ret uint16)
- func (rr *Reader) ReadUint256() (ret *big.Int)
- func (rr *Reader) ReadUint32() (ret uint32)
- func (rr *Reader) ReadUint64() (ret uint64)
- func (rr *Reader) ReadUint8() (ret uint8)
- type Skipper
- type Writer
- func (ww *Writer) Bytes() []byte
- func (ww *Writer) Skip() *Reader
- func (ww *Writer) Write(writer interface{ ... }) *Writer
- func (ww *Writer) WriteBool(val bool) *Writer
- func (ww *Writer) WriteByte(val byte) *Writer
- func (ww *Writer) WriteBytes(val []byte) *Writer
- func (ww *Writer) WriteDuration(val time.Duration) *Writer
- func (ww *Writer) WriteFromBytes(bytes interface{ ... }) *Writer
- func (ww *Writer) WriteInt16(val int16) *Writer
- func (ww *Writer) WriteInt32(val int32) *Writer
- func (ww *Writer) WriteInt64(val int64) *Writer
- func (ww *Writer) WriteInt8(val int8) *Writer
- func (ww *Writer) WriteKind(msgType Kind) *Writer
- func (ww *Writer) WriteMarshaled(m encoding.BinaryMarshaler) *Writer
- func (ww *Writer) WriteN(val []byte) *Writer
- func (ww *Writer) WriteSerialized(s serializable) *Writer
- func (ww *Writer) WriteSize16(val int) *Writer
- func (ww *Writer) WriteSize32(val int) *Writer
- func (ww *Writer) WriteSizeWithLimit(val int, limit uint32) *Writer
- func (ww *Writer) WriteString(val string) *Writer
- func (ww *Writer) WriteUint16(val uint16) *Writer
- func (ww *Writer) WriteUint256(val *big.Int) *Writer
- func (ww *Writer) WriteUint32(val uint32) *Writer
- func (ww *Writer) WriteUint64(val uint64) *Writer
- func (ww *Writer) WriteUint8(val uint8) *Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MarshalBinary ¶
MarshalBinary is an adapter function that uses an object's Write() function to marshal the object to data bytes. It is typically used to implement a one-line MarshalBinary() member function for the object.
func MustSize32FromBytes ¶
func ReadFromBytes ¶
ReadFromBytes allows a reader to use any <Type>FromBytes() function as a source. It will read the next group of bytes and pass it to the specified function and returns the correct type of object
func ReadMarshaled ¶
func ReadMarshaled(r io.Reader, val encoding.BinaryUnmarshaler) error
func ReaderFromBytes ¶
ReaderFromBytes is a wrapper that uses an object's Read() function to marshal the object from data bytes. It's typically used to implement a one-line <Type>FromBytes() function and returns the expected type and error.
func Size32FromBytes ¶
func Size32ToBytes ¶
func UnmarshalBinary ¶
UnmarshalBinary is an adapter function that uses an object's Read() function to marshal the object from data bytes. It is typically used to implement a one-line UnmarshalBinary member function for the object.
func WriteMarshaled ¶
func WriteMarshaled(w io.Writer, val encoding.BinaryMarshaler) error
Types ¶
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
func NewReadCounter ¶
func NewWriteCounter ¶
type Reader ¶
type Reader struct { Err error // contains filtered or unexported fields }
func NewBytesReader ¶
func (*Reader) PushBack ¶
PushBack returns a pushback writer that allows you to insert data before the stream. The Reader will read this data first, and then resume reading from the stream. The pushback Writer is only valid for this Reader until it resumes the stream.
func (*Reader) ReadDuration ¶
func (*Reader) ReadKindAndVerify ¶
func (*Reader) ReadMarshaled ¶
func (rr *Reader) ReadMarshaled(m encoding.BinaryUnmarshaler)
func (*Reader) ReadSerialized ¶
func (rr *Reader) ReadSerialized(s deserializable)
func (*Reader) ReadSize16 ¶
func (*Reader) ReadSize32 ¶
func (*Reader) ReadSizeWithLimit ¶
func (*Reader) ReadString ¶
func (*Reader) ReadUint16 ¶
func (*Reader) ReadUint256 ¶
func (*Reader) ReadUint32 ¶
func (*Reader) ReadUint64 ¶
type Writer ¶
type Writer struct { Err error // contains filtered or unexported fields }
func NewBytesWriter ¶
func NewBytesWriter() *Writer
func (*Writer) WriteBytes ¶
func (*Writer) WriteFromBytes ¶
func (*Writer) WriteInt16 ¶
func (*Writer) WriteInt32 ¶
func (*Writer) WriteInt64 ¶
func (*Writer) WriteMarshaled ¶
func (ww *Writer) WriteMarshaled(m encoding.BinaryMarshaler) *Writer