Struct string_interner::backend::SimpleBackend
source · pub struct SimpleBackend<S = DefaultSymbol> { /* private fields */ }
Expand description
A simple backend that stores a separate allocation for every interned string.
Use this if you can afford many small allocations and if you want to have especially decent performance for look-ups when the string interner is already filled to some extend.
§Usage Hint
Never actually use this interner backend since it only acts as a trivial baseline.
§Usage
- Fill: Efficiency of filling an empty string interner.
- Resolve: Efficiency of interned string look-up given a symbol.
- Allocations: The number of allocations performed by the backend.
- Footprint: The total heap memory consumed by the backend.
- Contiguous: True if the returned symbols have contiguous values.
Rating varies between bad, ok, good and best.
Scenario | Rating |
---|---|
Fill | bad |
Resolve | good |
Allocations | bad |
Footprint | bad |
Supports get_or_intern_static | no |
Send + Sync | yes |
Contiguous | yes |
Trait Implementations§
source§impl<S> Backend for SimpleBackend<S>where
S: Symbol,
impl<S> Backend for SimpleBackend<S>where
S: Symbol,
source§fn with_capacity(cap: usize) -> Self
fn with_capacity(cap: usize) -> Self
Creates a new backend for the given capacity. Read more
source§fn intern(&mut self, string: &str) -> Self::Symbol
fn intern(&mut self, string: &str) -> Self::Symbol
Interns the given string and returns its interned ref and symbol. Read more
source§fn shrink_to_fit(&mut self)
fn shrink_to_fit(&mut self)
Shrink backend capacity to fit interned symbols exactly.
source§fn resolve(&self, symbol: Self::Symbol) -> Option<&str>
fn resolve(&self, symbol: Self::Symbol) -> Option<&str>
Resolves the given symbol to its original string contents.
source§impl<S> Clone for SimpleBackend<S>
impl<S> Clone for SimpleBackend<S>
source§impl<S: Debug> Debug for SimpleBackend<S>
impl<S: Debug> Debug for SimpleBackend<S>
source§impl<S> Default for SimpleBackend<S>
impl<S> Default for SimpleBackend<S>
source§impl<'a, S> IntoIterator for &'a SimpleBackend<S>where
S: Symbol,
impl<'a, S> IntoIterator for &'a SimpleBackend<S>where
S: Symbol,
source§impl<S> PartialEq for SimpleBackend<S>where
S: Symbol,
impl<S> PartialEq for SimpleBackend<S>where
S: Symbol,
impl<S> Eq for SimpleBackend<S>where
S: Symbol,
Auto Trait Implementations§
impl<S> RefUnwindSafe for SimpleBackend<S>
impl<S> Send for SimpleBackend<S>
impl<S> Sync for SimpleBackend<S>
impl<S> Unpin for SimpleBackend<S>
impl<S> UnwindSafe for SimpleBackend<S>
Blanket Implementations§
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
Mutably borrows from an owned value. Read more