Expand description
EBML variable-length integer (VINT) decode — RFC 8794
(docs/standards/registry.toml id rfc-8794-ebml).
A VINT’s first byte encodes its total length L (1..=8) as a unary
prefix: the position of the leading 1 bit (VINT_MARKER) counted from
the most significant bit gives L. Every bit after the marker — the rest
of the first byte plus all following bytes — is VINT_DATA (7*L bits).
Two decodes share this shape but differ in what counts as “the value”:
- Element size (
decode_size): the marker is stripped; an all-1sVINT_DATAis the reserved “unknown size” sentinel (VintSize::unknown). - Element ID (
decode_id): the marker bit is kept — the ID is the rawLbytes read as a big-endian integer (RFC 8794 §7).
These are public, low-level, and usable standalone (probe/debug tooling), per the workspace “low-level APIs stay first-class” rule.
Structs§
- Vint
Size - Decoded element size VINT (marker stripped).
Functions§
- decode_
id - Decode an element ID VINT at the start of
buf(marker bits kept). - decode_
size - Decode an element size VINT at the start of
buf(marker stripped). - encode_
id - Encode an element ID (marker bits already included, matching
decode_id’s raw representation) intoout, using the minimal byte length that holds the value without a leading zero byte. - encode_
size - Encode an element size VINT (marker stripped from
value, marker bit added on write) intoout. - encode_
unknown_ size - Write the reserved “unknown size” VINT of length
len(1..=8) intoout— allVINT_DATAbits set to1, marker bit set.