Module prefix
Available on crate features
http and std only.Expand description
QPACK prefixed integers (RFC 9204 §4.1.1) and string literals (RFC 9204 §4.1.2).
These are the shared low-level codings under every QPACK field-line and instruction
representation. They are decoded from a slice cursor (&mut &[u8]); a decoder that needs to
recover from a short read treats PrefixError::UnexpectedEnd as “need more bytes” and retries
from the start of the (retained) buffer. This transactional style keeps the codings themselves
free of retained state while still supporting fragmented input.
Structs§
- Decoded
String - A decoded QPACK string literal, plus whether it was Huffman-encoded on the wire.
- String
Encoder - A borrowed string encoding plan that uses Huffman only when it reduces wire size.
Enums§
- Prefix
Error - An error decoding a prefixed integer or string.
Functions§
- decode_
int - Decode a prefixed integer with an
prefix_bits-bit prefix fromsrc, consuming the bytes it uses (RFC 9204 §4.1.1). High bits of the first byte above the prefix are ignored — a caller reads any representation flags from the first byte before calling this. - decode_
string - Decode a string literal with an
prefix_bits-bit length prefix, rejecting a decoded length abovemax_len(RFC 9204 §4.1.2). Plain lengths are checked before allocating; Huffman output is bounded during decoding. - encode_
int - Encode
valueas a prefixed integer with anprefix_bits-bit prefix, OR-ingflagsinto the high8 - prefix_bitsbits of the first byte (RFC 9204 §4.1.1). - encode_
string - Encode a string literal with an
prefix_bits-bit length prefix (RFC 9204 §4.1.2). - int_
encoded_ len - Number of wire bytes needed by a prefixed integer.
- string_
encoded_ len - Number of wire bytes needed by a string, including its length prefix.