pub struct ScopedInterner { /* private fields */ }Expand description
A scoped string interner for temporary use.
Strings interned here are freed when the interner is dropped. Use this for request-scoped interning to avoid memory growth.
Implementations§
Source§impl ScopedInterner
impl ScopedInterner
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Create a scoped interner with pre-allocated capacity.
Sourcepub fn intern(&mut self, s: &str) -> InternedStr
pub fn intern(&mut self, s: &str) -> InternedStr
Intern a string within this scope.
Sourcepub fn get(&self, s: &str) -> Option<InternedStr>
pub fn get(&self, s: &str) -> Option<InternedStr>
Try to get an already-interned string.
Sourcepub fn stats(&self) -> &InternerStats
pub fn stats(&self) -> &InternerStats
Get statistics.
Trait Implementations§
Source§impl Default for ScopedInterner
impl Default for ScopedInterner
Source§fn default() -> ScopedInterner
fn default() -> ScopedInterner
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ScopedInterner
impl RefUnwindSafe for ScopedInterner
impl Send for ScopedInterner
impl Sync for ScopedInterner
impl Unpin for ScopedInterner
impl UnwindSafe for ScopedInterner
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