pub struct ConcurrentStringInterner { /* private fields */ }Expand description
Thread-safe string interner using sharded locks
Uses a simple hash-based sharding to reduce lock contention when multiple threads are interning strings concurrently.
Implementations§
Source§impl ConcurrentStringInterner
impl ConcurrentStringInterner
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Create a new concurrent string interner with pre-allocated capacity
Sourcepub fn get_or_intern(&self, s: &str) -> Symbol
pub fn get_or_intern(&self, s: &str) -> Symbol
Intern a string and return its symbol
Sourcepub fn memory_usage(&self) -> usize
pub fn memory_usage(&self) -> usize
Get memory usage estimate in bytes
Trait Implementations§
Source§impl Debug for ConcurrentStringInterner
impl Debug for ConcurrentStringInterner
Source§impl Default for ConcurrentStringInterner
impl Default for ConcurrentStringInterner
impl Send for ConcurrentStringInterner
impl Sync for ConcurrentStringInterner
Auto Trait Implementations§
impl !Freeze for ConcurrentStringInterner
impl !RefUnwindSafe for ConcurrentStringInterner
impl Unpin for ConcurrentStringInterner
impl UnwindSafe for ConcurrentStringInterner
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
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>
Converts
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>
Converts
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