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>
impl<'storage, 'entries> HpackDynamicTable<'storage, 'entries>
Sourcepub fn new(
storage: &'storage mut [u8],
entries: &'entries mut [HpackDynamicTableEntry],
maximum_size: usize,
) -> Result<Self, HpackDynamicTableError>
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.
Sourcepub const fn capacity(&self) -> usize
pub const fn capacity(&self) -> usize
Returns the maximum RFC size supported by the supplied caller storage.
Sourcepub const fn maximum_size(&self) -> usize
pub const fn maximum_size(&self) -> usize
Returns the current configured RFC dynamic-table maximum.
Sourcepub fn get(&self, index: usize) -> Option<HpackHeaderFieldRef<'_>>
pub fn get(&self, index: usize) -> Option<HpackHeaderFieldRef<'_>>
Returns the field at a one-based dynamic index, where 1 is newest.
Sourcepub fn set_maximum_size(
&mut self,
maximum_size: usize,
) -> Result<(), HpackDynamicTableError>
pub fn set_maximum_size( &mut self, maximum_size: usize, ) -> Result<(), HpackDynamicTableError>
Updates the configured maximum, evicting oldest entries immediately if needed.
Sourcepub fn entry_size(
name: &[u8],
value: &[u8],
) -> Result<usize, HpackDynamicTableError>
pub fn entry_size( name: &[u8], value: &[u8], ) -> Result<usize, HpackDynamicTableError>
Calculates an RFC 7541 entry size from opaque name and value bytes.
Sourcepub fn insert(
&mut self,
name: &[u8],
value: &[u8],
) -> Result<HpackDynamicTableInsertResult, HpackDynamicTableError>
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.