pub struct SymbolDict { /* private fields */ }Expand description
Connection-scoped symbol dictionary.
Implementations§
Source§impl SymbolDict
impl SymbolDict
pub fn new() -> Self
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Number of entries currently stored. Also the next conn-id to assign.
pub fn is_empty(&self) -> bool
Sourcepub fn heap_bytes(&self) -> usize
pub fn heap_bytes(&self) -> usize
UTF-8 bytes currently held in the arena.
Sourcepub fn get(&self, id: u32) -> Option<&str>
pub fn get(&self, id: u32) -> Option<&str>
Resolve a connection-scoped symbol id to its UTF-8 string.
Sourcepub fn entries(&self) -> &[SymbolEntry]
pub fn entries(&self) -> &[SymbolEntry]
Entry table: index i addresses the conn-id-i symbol’s bytes
within arena.
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Clear all state. Triggered by a CACHE_RESET with the dict bit.
Shrinks the backing allocations so a previously-saturated dict
doesn’t keep its full heap reserved after the reset.
Sourcepub fn apply_delta<'a, I>(&mut self, delta_start: u64, entries: I) -> Result<()>where
I: IntoIterator<Item = &'a [u8]>,
pub fn apply_delta<'a, I>(&mut self, delta_start: u64, entries: I) -> Result<()>where
I: IntoIterator<Item = &'a [u8]>,
Apply a delta whose first new id is delta_start and whose entries
are produced in order. Validates UTF-8 and the sequencing invariant.
Sourcepub fn apply_delta_from_bytes(&mut self, bytes: &[u8]) -> Result<usize>
pub fn apply_delta_from_bytes(&mut self, bytes: &[u8]) -> Result<usize>
Decode + apply a delta directly from the wire bytes. Returns the number of bytes consumed.
All-or-nothing: if any entry in the delta is malformed, the dict
is rolled back to its pre-call state. Without this, a partial
failure would leave self.entries.len() between the old and new
expected values, and every subsequent delta would mismatch the
delta_start check above and break the connection until reset.
Trait Implementations§
Source§impl Clone for SymbolDict
impl Clone for SymbolDict
Source§fn clone(&self) -> SymbolDict
fn clone(&self) -> SymbolDict
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SymbolDict
impl Debug for SymbolDict
Source§impl Default for SymbolDict
impl Default for SymbolDict
Source§fn default() -> SymbolDict
fn default() -> SymbolDict
Auto Trait Implementations§
impl Freeze for SymbolDict
impl RefUnwindSafe for SymbolDict
impl Send for SymbolDict
impl Sync for SymbolDict
impl Unpin for SymbolDict
impl UnsafeUnpin for SymbolDict
impl UnwindSafe for SymbolDict
Blanket Implementations§
impl<T> Allocation for T
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more