pub struct StringInterner { /* private fields */ }Expand description
Implementations§
Source§impl StringInterner
impl StringInterner
Creates a StringInterner sharing the backing pool with other.
Sourcepub fn intern(&self, s: &str) -> InternedStr
pub fn intern(&self, s: &str) -> InternedStr
Interns s and returns an InternedStr handle.
Acquiring the lock returns an error only if the mutex is poisoned (a panic occurred while the lock was held). In that case this method panics with a descriptive message rather than silently continuing.
Sourcepub fn resolve(&self, handle: InternedStr) -> Option<&'static str>
pub fn resolve(&self, handle: InternedStr) -> Option<&'static str>
Resolves handle to its &'static str content.
Returns None if the handle was not produced by this interner.
Sourcepub fn total_bytes(&self) -> usize
pub fn total_bytes(&self) -> usize
Returns the total byte count of all interned strings.
Sourcepub fn arc_clone(&self) -> Arc<Mutex<InternPool>>
pub fn arc_clone(&self) -> Arc<Mutex<InternPool>>
Clones the underlying Arc so the pool can be shared across threads.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StringInterner
impl RefUnwindSafe for StringInterner
impl Send for StringInterner
impl Sync for StringInterner
impl Unpin for StringInterner
impl UnsafeUnpin for StringInterner
impl UnwindSafe for StringInterner
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