Struct string_interner::backend::BucketBackend [−][src]
pub struct BucketBackend<S = DefaultSymbol> { /* fields omitted */ }
Expand description
An interner backend that reduces memory allocations by using string buckets.
Note
Implementation inspired by matklad’s blog post that can be found here: https://matklad.github.io/2020/03/22/fast-simple-rust-interner.html
Usage Hint
Use when deallocations or copy overhead is costly or when interning of static strings is especially common.
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 | good |
Resolve | ok |
Allocations | good |
Footprint | ok |
Supports get_or_intern_static | yes |
Send + Sync | yes |
Contiguous | yes |
Trait Implementations
type Symbol = S
type Symbol = S
The symbol used by the string interner backend.
Creates a new backend for the given capacity. Read more
Interns the given string and returns its interned ref and symbol. Read more
Interns the given static string and returns its interned ref and symbol. Read more
Shrink backend capacity to fit interned symbols exactly.
Resolves the given symbol to its original string contents.
Resolves the given symbol to its original string contents. Read more
Auto Trait Implementations
impl<S> RefUnwindSafe for BucketBackend<S>
impl<S> Unpin for BucketBackend<S>
impl<S> UnwindSafe for BucketBackend<S>
Blanket Implementations
Mutably borrows from an owned value. Read more