Expand description
QUIC variable-length integers (RFC 9000 §16).
Used for the header_len field of the stream preamble. The two most
significant bits of the first byte select the encoding length, so the
representable range is 0..=2^62-1.
Encoding always uses the shortest form. Decoding accepts any form, including non-minimal ones, exactly as RFC 9000 requires: a peer that pads its length field is unusual but not hostile, and rejecting it would be an interoperability bug rather than a defence.
Enums§
- Varint
Error - Why a varint could not be encoded or decoded.
Constants§
- MAX
- Largest value a QUIC varint can carry.
- MAX_
ENCODED_ LEN - Longest possible encoding, in bytes.
Functions§
- decode_
varint - Decodes a varint from the front of
input. - encode_
varint - Appends
valuetooutin its shortest QUIC varint form. - varint_
len - Number of bytes
encode_varintwill write forvalue. - write_
varint - Writes
valueinto the front ofoutin its shortest QUIC varint form, and reports how many bytes it took.