pub struct StringArena { /* private fields */ }Expand description
An arena-based allocator for interning strings.
Deduplicates strings by hash and returns lightweight StrRef handles for O(1) lookups.
Implementations§
Source§impl StringArena
impl StringArena
Sourcepub fn alloc(&mut self, value: &str) -> StrRef
pub fn alloc(&mut self, value: &str) -> StrRef
Interns a string and returns its StrRef. Returns the existing reference if already interned.
Sourcepub fn alloc_no_case(&mut self, value: &str) -> StrRef
pub fn alloc_no_case(&mut self, value: &str) -> StrRef
Interns a string using case-insensitive hashing.
Two strings that differ only in ASCII case will resolve to the same StrRef.
The original casing of the first insertion is preserved.
Sourcepub fn eq_ignore_ascii_case(&self, ka: StrRef, kb: StrRef) -> bool
pub fn eq_ignore_ascii_case(&self, ka: StrRef, kb: StrRef) -> bool
Compares two interned strings for case-insensitive ASCII equality.
Trait Implementations§
Source§impl Default for StringArena
impl Default for StringArena
Source§fn default() -> StringArena
fn default() -> StringArena
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for StringArena
impl RefUnwindSafe for StringArena
impl Send for StringArena
impl Sync for StringArena
impl Unpin for StringArena
impl UnwindSafe for StringArena
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