pub struct Table<'a> { /* private fields */ }Expand description
A table representing a single index address space for headers where the static and the dynamic table are combined.
Implementations§
Source§impl<'a> Table<'a>
impl<'a> Table<'a>
Sourcepub fn with_dynamic_size(max_dynamic_size: u32) -> Self
pub fn with_dynamic_size(max_dynamic_size: u32) -> Self
Returns a new header table instance with the provided maximum allowed size of the dynamic table.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the total number of headers. The result includes the sum of all entries of the static and the dynamic table combined.
Sourcepub fn dynamic_len(&self) -> usize
pub fn dynamic_len(&self) -> usize
Returns the total number of entries stored in the dynamic table.
Sourcepub fn dynamic_size(&self) -> u32
pub fn dynamic_size(&self) -> u32
Returns the total size (in octets) of all the entries stored in the dynamic table.
Sourcepub fn max_dynamic_size(&self) -> u32
pub fn max_dynamic_size(&self) -> u32
Returns the maximum allowed size of the dynamic table.
Sourcepub fn update_max_dynamic_size(&mut self, size: u32)
pub fn update_max_dynamic_size(&mut self, size: u32)
Updates the maximum allowed size of the dynamic table.
Sourcepub fn iter(&'a self) -> TableIter<'a> ⓘ
pub fn iter(&'a self) -> TableIter<'a> ⓘ
Returns an iterator through all the headers.
It includes entries stored in the static and the dynamic table. Since
the index 0 is an invalid index, the first returned item is at index
1. The entries returned have indices ordered sequentially in the
single address space (first the headers in the static table, followed by
headers in the dynamic table).
Sourcepub fn get(&self, index: u32) -> Option<(&[u8], &[u8])>
pub fn get(&self, index: u32) -> Option<(&[u8], &[u8])>
Finds a header by its index.
According to the HPACK specification, the index 0 must be treated as
an invalid index number. The value for index 0 in the static table is
thus missing. The index of 0 will always return None.
Sourcepub fn find(&self, name: &[u8], value: &[u8]) -> Option<(usize, bool)>
pub fn find(&self, name: &[u8], value: &[u8]) -> Option<(usize, bool)>
Searches the static and the dynamic tables for the provided header.
It tries to match both the header name and value to one of the headers in the table. If no such header exists, then it falls back to the one that matched only the name. The returned match contains the index of the header in the table and a boolean indicating whether the value of the header also matched.