package postcard

Import Path
	github.com/tmc/go-iroh/internal/postcard (on go.dev)

Dependency Relation
	imports 6 packages, and imported by one package

Involved Source Files Package postcard encodes and decodes the Rust postcard wire format. Integers are varints, little-endian base-128, and signed integers are zigzagged first, except for u8 and i8: postcard writes those as one raw byte. Go values of kind uint8 and int8 follow that rule, so uint8(200) encodes as "c8" and int8(-2) as "fe". The 8-bit encoding changed in this v0 release: uint8 and int8 were previously written as a varint and a zigzag varint, which did not match Rust. A uint8 below 128 encodes to the same single byte either way, so records holding only small u8 tags are unaffected; a uint8 of 128 or more, and an int8 of anything but zero, encoded differently before and cannot be read back by this version. Decoding accepts only canonical varints: a padded encoding such as "ac8200" for 300 is rejected with [ErrOverlongVarint], so distinct byte strings never decode to the same value.
Package-Level Type Names (total 5)
/* sort by: | */
Decoder incrementally decodes postcard values. Bool decodes a postcard bool. BytesValue decodes a postcard byte sequence. Decode decodes the next postcard value into v. Done reports whether d consumed all input. Int decodes a postcard signed integer. Use [Decoder.Int8] for a Rust i8, which is not zigzag-encoded. Int8 decodes a postcard i8: one raw byte holding the two's complement. RawBytes decodes n bytes without a length prefix. String decodes a postcard string. Uint decodes a postcard unsigned integer. Use [Decoder.Uint8] for a Rust u8, which is not varint-encoded. Uint8 decodes a postcard u8: one raw byte. *Decoder : github.com/grpc-ecosystem/grpc-gateway/v2/runtime.Decoder func NewDecoder(b []byte) *Decoder func DecoderFrom.DecodePostcard(*Decoder) error func github.com/tmc/go-iroh/internal/relayproto.(*KeyMaterialClientAuth).DecodePostcard(d *Decoder) error
DecoderFrom is implemented by values that decode themselves from d. ( DecoderFrom) DecodePostcard(*Decoder) error *github.com/tmc/go-iroh/internal/relayproto.KeyMaterialClientAuth
Encoder incrementally encodes postcard values. Bool appends v as a postcard bool. Bytes returns a copy of the encoded bytes. BytesValue appends b as a postcard byte sequence. Encode appends v to e. Int appends v as a postcard signed integer. Use [Encoder.Int8] for a Rust i8, which is not zigzag-encoded. Int8 appends v as a postcard i8: one raw byte holding the two's complement, not a zigzag varint. RawBytes appends b without a length prefix. String appends s as a postcard string. Uint appends v as a postcard unsigned integer. Use [Encoder.Uint8] for a Rust u8, which is not varint-encoded. Uint8 appends v as a postcard u8: one raw byte, not a varint. *Encoder : github.com/apache/arrow-go/v18/internal/hashing.ByteSlice *Encoder : github.com/grpc-ecosystem/grpc-gateway/v2/runtime.Encoder func EncoderTo.EncodePostcard(*Encoder) error func github.com/tmc/go-iroh/internal/relayproto.KeyMaterialClientAuth.EncodePostcard(e *Encoder) error
EncoderTo is implemented by values that encode themselves to e. ( EncoderTo) EncodePostcard(*Encoder) error github.com/tmc/go-iroh/internal/relayproto.KeyMaterialClientAuth
Marshaler is implemented by values with a custom postcard representation. ( Marshaler) MarshalPostcard() ([]byte, error)
Package-Level Functions (total 3)
Marshal encodes v in postcard format.
NewDecoder returns a decoder reading b.
Unmarshal decodes postcard data into v.
Package-Level Variables (total 2)
ErrOverlongVarint is returned for a varint that is not canonically encoded: one padded with continuation bytes past the shortest form, or one whose value does not fit in 64 bits.
ErrTrailingBytes is returned when Unmarshal does not consume all input.