Skip to main content

Module prefix

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§

DecodedString
A decoded QPACK string literal, plus whether it was Huffman-encoded on the wire.
StringEncoder
A borrowed string encoding plan that uses Huffman only when it reduces wire size.

Enums§

PrefixError
An error decoding a prefixed integer or string.

Functions§

decode_int
Decode a prefixed integer with an prefix_bits-bit prefix from src, 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 above max_len (RFC 9204 §4.1.2). Plain lengths are checked before allocating; Huffman output is bounded during decoding.
encode_int
Encode value as a prefixed integer with an prefix_bits-bit prefix, OR-ing flags into the high 8 - prefix_bits bits 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.