pub struct Encoder {
pub huffman: bool,
pub indexing: bool,
/* private fields */
}Expand description
A stateful header block encoder.
Exact static or dynamic matches are sent as indexed fields; other fields are literals with incremental indexing, except sensitive fields (never indexed), fields whose values rarely repeat, and fields larger than half the table (without indexing). Strings are Huffman coded when that is shorter.
Fields§
§huffman: boolUse Huffman coding when it is shorter (default true).
indexing: boolAdd literals to the dynamic table (default true).
Implementations§
Source§impl Encoder
impl Encoder
Sourcepub fn new(limit: usize) -> Self
pub fn new(limit: usize) -> Self
An encoder that keeps at most limit bytes of dynamic table. The peer’s table starts at
4096 (the protocol default); a smaller limit is announced in the first block.
Sourcepub fn set_peer_max_table_size(&mut self, peer: usize)
pub fn set_peer_max_table_size(&mut self, peer: usize)
Applies the peer’s SETTINGS_HEADER_TABLE_SIZE. The encoder uses the smaller of that and its own limit, and announces the change at the start of the next block.
Sourcepub fn table_size(&self) -> usize
pub fn table_size(&self) -> usize
Current dynamic table size in octets.
Sourcepub fn begin_block(&mut self, out: &mut Vec<u8>)
pub fn begin_block(&mut self, out: &mut Vec<u8>)
Starts a header block: emits any pending dynamic table size updates (RFC 7541 §4.2).