pub struct Decoder { /* private fields */ }Expand description
The connection-level HPACK decoder of one direction.
Implementations§
Source§impl Decoder
impl Decoder
Sourcepub const fn new() -> Self
pub const fn new() -> Self
A decoder with the default 4096-octet table and no size-update bound
until Self::set_max_allowed_table_size sets one. Allocates nothing.
Sourcepub fn set_max_allowed_table_size(&mut self, max_allowed_size: usize)
pub fn set_max_allowed_table_size(&mut self, max_allowed_size: usize)
Sets the largest size a peer’s size update may announce: the
SETTINGS_HEADER_TABLE_SIZE this endpoint advertised (RFC 7541 §4.2).
Sourcepub fn set_max_table_size(&mut self, max_size: usize)
pub fn set_max_table_size(&mut self, max_size: usize)
Sets the table’s maximum size directly, as a size update would, and evicts until the table fits.
Sourcepub fn shrink_scratch(&mut self, retain: usize)
pub fn shrink_scratch(&mut self, retain: usize)
Releases the scratch buffer when its capacity exceeds retain octets.
Sourcepub fn decode_with_cb<F>(
&mut self,
block: &[u8],
callback: F,
) -> Result<(), DecoderError>
pub fn decode_with_cb<F>( &mut self, block: &[u8], callback: F, ) -> Result<(), DecoderError>
Decodes one complete header block and calls callback(name, value) for
every field, in order. Both arguments are always Cow::Borrowed; the
type only saves the callers a conversion.
On error the block must be treated as a connection error of type COMPRESSION_ERROR (RFC 9113 §4.3): fields before the error have been delivered and inserted, and the table no longer matches the peer’s.