Skip to main content

QpackDynamicTable

Struct QpackDynamicTable 

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

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

Active entries and their bytes are packed newest first. Absolute indexes begin at zero and are never reset by eviction or capacity changes.

Implementations§

Source§

impl<'storage, 'entries> QpackDynamicTable<'storage, 'entries>

Source

pub fn new( storage: &'storage mut [u8], entries: &'entries mut [QpackDynamicTableEntry], ) -> Self

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

Source

pub const fn storage_capacity(&self) -> usize

Returns the greatest RFC dynamic-table capacity the supplied stores support.

Source

pub const fn capacity(&self) -> usize

Returns the current RFC dynamic-table capacity.

Source

pub const fn size(&self) -> usize

Returns the current RFC dynamic-table size.

Source

pub const fn len(&self) -> usize

Returns the number of active dynamic-table entries.

Source

pub const fn is_empty(&self) -> bool

Returns whether no dynamic-table entries are active.

Source

pub const fn insert_count(&self) -> u64

Returns the number of successful insertions since this table was created.

Source

pub fn oldest_active_absolute(&self) -> Option<u64>

Returns the oldest active zero-based absolute index, if any.

Source

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

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

Source

pub fn set_capacity<F>( &mut self, capacity: usize, evictable: F, ) -> Result<(), QpackDynamicTableError>
where F: FnMut(u64) -> bool,

Updates capacity, evicting the oldest entries allowed by evictable as needed.

Source

pub fn insert<F>( &mut self, name: &[u8], value: &[u8], evictable: F, ) -> Result<u64, QpackDynamicTableError>
where F: FnMut(u64) -> bool,

Copies a field into the table as the newest entry and returns its absolute index.

Source

pub fn get_absolute( &self, absolute: u64, ) -> Result<QpackHeaderFieldRef<'_>, QpackDynamicTableError>

Resolves a zero-based absolute index to an active borrowed header field.

Source

pub fn get_encoder_relative( &self, relative: u64, ) -> Result<QpackHeaderFieldRef<'_>, QpackDynamicTableError>

Resolves an encoder-stream relative index to an active borrowed header field.

Source

pub fn get_field_relative( &self, required_insert_count: u64, base: u64, relative: u64, ) -> Result<QpackHeaderFieldRef<'_>, QpackDynamicTableError>

Resolves a field-section relative index to an active borrowed header field.

Source

pub fn get_post_base( &self, required_insert_count: u64, base: u64, post_base: u64, ) -> Result<QpackHeaderFieldRef<'_>, QpackDynamicTableError>

Resolves a post-base index to an active borrowed header field.

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

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

§

impl<'storage, 'entries> UnsafeUnpin for QpackDynamicTable<'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.