Skip to main content

HpackDynamicTable

Struct HpackDynamicTable 

Source
pub struct HpackDynamicTable<'storage, 'entries> { /* private fields */ }
Expand description

Caller-owned, allocation-free RFC 7541 dynamic-table storage.

Entries are addressed with one-based dynamic indices, where index 1 is the newest entry. The table stores only its active packed bytes and active metadata; stale caller storage is never exposed after eviction or Self::clear. This type intentionally does not combine dynamic indices with the static table.

Implementations§

Source§

impl<'storage, 'entries> HpackDynamicTable<'storage, 'entries>

Source

pub fn new( storage: &'storage mut [u8], entries: &'entries mut [HpackDynamicTableEntry], maximum_size: usize, ) -> Result<Self, HpackDynamicTableError>

Creates a table backed by caller-supplied byte and metadata storage.

The maximum is validated before either store is changed.

Source

pub const fn capacity(&self) -> usize

Returns the maximum RFC size supported by the supplied caller storage.

Source

pub const fn len(&self) -> usize

Returns the number of active dynamic entries.

Source

pub const fn is_empty(&self) -> bool

Returns whether no dynamic entries are active.

Source

pub const fn size(&self) -> usize

Returns the current RFC dynamic-table size.

Source

pub const fn maximum_size(&self) -> usize

Returns the current configured RFC dynamic-table maximum.

Source

pub fn get(&self, index: usize) -> Option<HpackHeaderFieldRef<'_>>

Returns the field at a one-based dynamic index, where 1 is newest.

Source

pub fn clear(&mut self)

Removes all active entries without scrubbing inactive caller storage.

Source

pub fn set_maximum_size( &mut self, maximum_size: usize, ) -> Result<(), HpackDynamicTableError>

Updates the configured maximum, evicting oldest entries immediately if needed.

Source

pub fn entry_size( name: &[u8], value: &[u8], ) -> Result<usize, HpackDynamicTableError>

Calculates an RFC 7541 entry size from opaque name and value bytes.

Source

pub fn insert( &mut self, name: &[u8], value: &[u8], ) -> Result<HpackDynamicTableInsertResult, HpackDynamicTableError>

Copies a field into the table as the newest entry, evicting oldest entries as needed.

Auto Trait Implementations§

§

impl<'storage, 'entries> !UnwindSafe for HpackDynamicTable<'storage, 'entries>

§

impl<'storage, 'entries> Freeze for HpackDynamicTable<'storage, 'entries>

§

impl<'storage, 'entries> RefUnwindSafe for HpackDynamicTable<'storage, 'entries>

§

impl<'storage, 'entries> Send for HpackDynamicTable<'storage, 'entries>

§

impl<'storage, 'entries> Sync for HpackDynamicTable<'storage, 'entries>

§

impl<'storage, 'entries> Unpin for HpackDynamicTable<'storage, 'entries>

§

impl<'storage, 'entries> UnsafeUnpin for HpackDynamicTable<'storage, 'entries>

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.