pub struct Decoder { /* private fields */ }Expand description
A stateful header block decoder.
Implementations§
Source§impl Decoder
impl Decoder
Sourcepub fn new(max_table_size: usize, max_list_size: usize) -> Self
pub fn new(max_table_size: usize, max_list_size: usize) -> Self
A decoder whose dynamic table may grow to max_table_size (the value advertised in
SETTINGS_HEADER_TABLE_SIZE) and whose decoded header lists are capped at max_list_size.
Sourcepub fn set_max_allowed(&mut self, max: usize)
pub fn set_max_allowed(&mut self, max: usize)
Changes the largest table size the peer may select (after our new SETTINGS were acknowledged). A smaller value shrinks the table at once.
Sourcepub fn set_max_list_size(&mut self, max: usize)
pub fn set_max_list_size(&mut self, max: usize)
Changes the header list cap.
Sourcepub fn table_size(&self) -> usize
pub fn table_size(&self) -> usize
Current dynamic table size in octets (RFC 7541 §4.1).
Sourcepub fn table_max_size(&self) -> usize
pub fn table_max_size(&self) -> usize
Current dynamic table maximum (the last size update).
Sourcepub fn table_entry(&self, i: usize) -> Option<(&[u8], &[u8])>
pub fn table_entry(&self, i: usize) -> Option<(&[u8], &[u8])>
Dynamic table entry i (0 = newest).
Sourcepub fn decode(
&mut self,
block: &[u8],
emit: &mut dyn FnMut(&[u8], &[u8]),
) -> Result<(), Error>
pub fn decode( &mut self, block: &[u8], emit: &mut dyn FnMut(&[u8], &[u8]), ) -> Result<(), Error>
Decodes one complete header block, passing each field (name, value) to emit in order.
When the list grows past the cap the rest of the block is still decoded, to keep the
dynamic table in step, but not emitted, and Error::HeaderListTooLarge is returned.