Skip to main content

Module huffman

Module huffman 

Source
Expand description

The static Huffman code of HPACK (RFC 7541 §5.2, Appendix B), shared with QPACK (RFC 9204 §4.1.2).

The table below is Appendix B transcribed: one (code, bits) pair per symbol, 0 to 255 and EOS (256), code right-aligned. Decoding walks a binary tree built from it at compile time by a const fn, so there is no hand-written second table to disagree with the first.

Functions§

decode
Appends the decoding of input to out, refusing to produce more than cap octets.
encode
Appends s Huffman-coded, padded with the most significant bits of EOS (all ones) to an octet boundary.
encoded_len
The length of s Huffman-coded, padding included.