Skip to main content

Encoder

Struct Encoder 

Source
pub struct Encoder { /* private fields */ }
Available on crate feature h2 and (crate features h2 or h3) only.
Expand description

Encodes HPACK header blocks.

Implementations§

Source§

impl Encoder

Source

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.

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Debug for Encoder

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.