Skip to main content

Module encoding

Module encoding 

Source
Expand description

Wire format encoding and decoding primitives.

Implements the protobuf binary wire format: varints, fixed-width integers, length-delimited fields, and tag parsing.

Structs§

Tag
A parsed field tag (field number + wire type).

Enums§

WireType
Protobuf wire types.

Constants§

FIRST_RESERVED_FIELD_NUMBER
The first field number of the band reserved for the protobuf implementation, 19000.
LAST_RESERVED_FIELD_NUMBER
The last field number of the implementation-reserved band, 19999 (inclusive). See FIRST_RESERVED_FIELD_NUMBER.
MAX_FIELD_NUMBER
The maximum valid protobuf field number, 2^29 − 1.

Functions§

check_wire_type
Verify a decoded tag carries the expected wire type.
count_varints
Count the varints in a packed payload, i.e. the number of bytes whose continuation bit is clear (b < 0x80).
decode_unknown_field
Decode one unknown field’s value from buf and return it as an UnknownField.
decode_varint
Decode a varint from a buffer.
encode_varint
Encode a varint to a buffer.
skip_field
Skip one field value from buf according to the wire type in tag.
skip_field_depth
Skip a field’s payload, with an explicit recursion depth budget for groups.
skip_unknown_field
Skip an unknown wire field while enforcing explicit unknown-field rejection.
varint_len
Compute the encoded length of a varint.
wire_type_mismatch
Construct a DecodeError::WireTypeMismatch for tag.