pub struct PrefixPool { /* private fields */ }Expand description
A string pool that also supports finding the longest interned prefix of a given string.
Implementations§
Source§impl PrefixPool
impl PrefixPool
Sourcepub fn intern(&mut self, s: &str) -> InternedString
pub fn intern(&mut self, s: &str) -> InternedString
Intern a string.
Sourcepub fn longest_prefix(&self, s: &str) -> Option<InternedString>
pub fn longest_prefix(&self, s: &str) -> Option<InternedString>
Find the longest interned string that is a prefix of s.
Sourcepub fn all_prefixes(&self, s: &str) -> Vec<InternedString>
pub fn all_prefixes(&self, s: &str) -> Vec<InternedString>
All interned strings that are prefixes of s, ordered by length descending.
Sourcepub fn resolve(&self, id: InternedString) -> Option<&str>
pub fn resolve(&self, id: InternedString) -> Option<&str>
Resolve an interned string.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PrefixPool
impl RefUnwindSafe for PrefixPool
impl Send for PrefixPool
impl Sync for PrefixPool
impl Unpin for PrefixPool
impl UnsafeUnpin for PrefixPool
impl UnwindSafe for PrefixPool
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