Struct HpackContext

Source
#[repr(C)]
pub struct HpackContext { pub dynamics: VecDeque<DynamicHeader>, /* private fields */ }
Expand description

HpackContext contains the state, namely dynamic table and capacity setting, for either the transmitting or receiving part of a connection.

Fields§

§dynamics: VecDeque<DynamicHeader>

Implementations§

Source§

impl HpackContext

Source

pub fn new() -> HpackContext

Instantiate an HpackContext with the specification’s default dynamic table capacity of 4,096 octets.

Source

pub fn with_capacity(size: u32) -> HpackContext

Instantiate an HpackContext with a dynamic table capacity of the given number of octets.

Source

pub fn len(&self) -> usize

Number of headers in the context, both static and dynamic.

Source

pub fn capacity(&self) -> u32

The number of octets, with HPACK-specified overhead included, that the dynamic table can hold.

Source

pub fn used(&self) -> u32

The number of octets, with HPACK-specified overhead included, that are used by the dynamic table.

Source

pub fn set_capacity(&mut self, value: u32)

Set the dynamic table’s capacity to the number of HPACK-specified octets given. The value given must be from a SETTINGS frame.

Headers will be evicted from the dynamic table as necessary.

Source

pub fn settings_capacity(&self) -> u32

Source

pub fn resize(&mut self, value: u32) -> Result<(), HpackDecodeError>

Resize the dynamic table’s size to the number of HPACK-specified octets given.

Headers will be evicted from the dynamic table as necessary.

Source

pub fn insert(&mut self, name: &[u8], value: &[u8]) -> bool

Insert a header into the dynamic table.

If the given header exceeds the dynamic table’s size, the insert may only clear the dynamic table without being added. The returned bool indicates whether the header was added or not.

If it was added, it now occupies the first dynamic index.

Source

pub fn header_by_index(&self, idx: usize) -> Option<(&[u8], &[u8])>

Look up a header by a client’s index value.

Source

pub fn header_name_by_index(&self, idx: usize) -> Option<&[u8]>

Look up a header name by a client’s index value.

Source

pub fn get_index(&self, name: &[u8], value: &[u8]) -> u64

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.