pub struct StringInterner { /* private fields */ }Expand description
Arena-based string interner for efficient string deduplication.
Implementations§
Source§impl StringInterner
impl StringInterner
Sourcepub fn with_capacity(string_bytes: usize, num_strings: usize) -> Self
pub fn with_capacity(string_bytes: usize, num_strings: usize) -> Self
Create an interner with pre-allocated capacity.
Sourcepub fn intern_bytes(&mut self, s: &[u8]) -> StringId
pub fn intern_bytes(&mut self, s: &[u8]) -> StringId
Intern a byte string, returning its StringId.
Sourcepub fn intern(&mut self, s: &str) -> StringId
pub fn intern(&mut self, s: &str) -> StringId
Intern a UTF-8 string. Convenience wrapper around intern_bytes.
Sourcepub fn get_bytes_id(&self, s: &[u8]) -> Option<StringId>
pub fn get_bytes_id(&self, s: &[u8]) -> Option<StringId>
Get the StringId for a byte string without interning it.
Sourcepub fn get_id(&self, s: &str) -> Option<StringId>
pub fn get_id(&self, s: &str) -> Option<StringId>
Get the StringId for a UTF-8 string without interning it.
Trait Implementations§
Source§impl Clone for StringInterner
impl Clone for StringInterner
Source§fn clone(&self) -> StringInterner
fn clone(&self) -> StringInterner
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StringInterner
impl Debug for StringInterner
Source§impl Default for StringInterner
impl Default for StringInterner
Source§fn default() -> StringInterner
fn default() -> StringInterner
Returns the “default value” for a type. Read more
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