pub struct Trie { /* private fields */ }Expand description
Trie (Prefix Tree) for string storage and retrieval
Implementations§
Source§impl Trie
impl Trie
Sourcepub fn starts_with(&self, prefix: &str) -> bool
pub fn starts_with(&self, prefix: &str) -> bool
Check if any word starts with the given prefix
Sourcepub fn words_with_prefix(&self, prefix: &str) -> Vec<String>
pub fn words_with_prefix(&self, prefix: &str) -> Vec<String>
Get all words with the given prefix
Sourcepub fn word_count(&self) -> usize
pub fn word_count(&self) -> usize
Get the number of words stored in the trie
Sourcepub fn structural_equals(&self, other: &Self) -> bool
pub fn structural_equals(&self, other: &Self) -> bool
Compare two tries for structural equality
Sourcepub fn contains_trie(&self, other: &Self) -> bool
pub fn contains_trie(&self, other: &Self) -> bool
Check if this trie contains all words from another trie
Sourcepub fn statistics(&self) -> TrieStatistics
pub fn statistics(&self) -> TrieStatistics
Get trie statistics
Sourcepub fn longest_common_prefix(&self) -> String
pub fn longest_common_prefix(&self) -> String
Get the longest common prefix of all words in the trie
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Trie
impl RefUnwindSafe for Trie
impl Send for Trie
impl Sync for Trie
impl Unpin for Trie
impl UnwindSafe for Trie
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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