pub struct Encoder { /* private fields */ }h2 and (crate features h2 or h3) only.Expand description
Encodes HPACK header blocks.
Implementations§
Source§impl Encoder
impl Encoder
Sourcepub fn new(max_table_size: usize) -> Self
pub fn new(max_table_size: usize) -> Self
Creates an encoder whose table allows max_table_size octets
(RFC 7541 Section 4.2: 4096 by default). This must match the
peer’s initial SETTINGS_HEADER_TABLE_SIZE.
Sourcepub fn queue_size_update(&mut self, size: usize)
pub fn queue_size_update(&mut self, size: usize)
Queues a protocol-level table size update (from SETTINGS) to be applied and emitted at the start of the next header block.
Sourcepub fn set_use_huffman(&mut self, use_huffman: bool)
pub fn set_use_huffman(&mut self, use_huffman: bool)
Controls Huffman-coded string literals. Enabled by default, in which case a literal is Huffman-coded when that is shorter.
Sourcepub fn encode(&mut self, headers: &[Header], out: &mut Vec<u8>)
pub fn encode(&mut self, headers: &[Header], out: &mut Vec<u8>)
Encodes headers as a single header block appended to out.
Non-sensitive headers are encoded with incremental indexing
(RFC 7541 Section 6.2.1) and added to the dynamic table; exact
matches use the indexed representation (Section 6.1). Sensitive
headers ([NEVER_INDEXED]) are encoded never-indexed (Section
6.2.3) and never added to the table.