Skip to main content

Decoder

Struct Decoder 

Source
pub struct Decoder { /* private fields */ }
Expand description

An HPACK decoder: one per connection direction.

Implementations§

Source§

impl Decoder

Source

pub fn new(max_table_size: u32) -> Self

A decoder whose table is bounded by max_table_size, the SETTINGS_HEADER_TABLE_SIZE this side advertised.

Source

pub fn set_max_table_size(&mut self, max: u32)

Follows a change of our SETTINGS_HEADER_TABLE_SIZE: later updates are bounded by it, and the table shrinks to it at once.

Source

pub fn decode( &mut self, block: &[u8], limits: Limits, out: &mut Vec<(Vec<u8>, Vec<u8>)>, ) -> Result<(), DecodeError>

Decodes one complete field block, appending (name, value) pairs to out in order.

§Errors

TooLarge "field section" when the fields, counted as name plus value plus 32 each (RFC 9113 §6.5.2), exceed Limits::max_head_bytes, "field count" past Limits::max_fields, "string" for one string longer than max_head_bytes; Malformed naming the rule: "index", a table size update that is "not at the start of a block" or "above the advertised table size", "truncated field block", "integer", the Huffman refusals. After any of these the decoder must not be used again: the dynamic table may hold half a block (RFC 7541 §2.3.3 makes this a connection error).

Malformed "uppercase field name" is the exception: the block is decoded to its end first, so the dynamic table stays in step with the peer’s encoder and the connection can refuse only that stream (RFC 9113 §8.2.1). out then holds the block’s fields.

Trait Implementations§

Source§

impl Debug for Decoder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.