pub struct Trie<'a, T> { /* private fields */ }
Expand description
Trie is a data structure that stores a set of strings. It is used to find the longest match of a string.
§Example
use rk_utils::Trie;
let mut trie = Trie::new();
trie.insert(vec!["a", "b", "c"], 1);
trie.insert(vec!["a", "b", "d"], 2);
assert_eq!(trie.find_longest_match(vec!["a", "b", "c", "d"]), Some(&1));
assert_eq!(trie.find_longest_match(vec!["a", "b", "d", "e"]), Some(&2));
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<'a, T> Freeze for Trie<'a, T>where
T: Freeze,
impl<'a, T> RefUnwindSafe for Trie<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for Trie<'a, T>where
T: Send,
impl<'a, T> Sync for Trie<'a, T>where
T: Sync,
impl<'a, T> Unpin for Trie<'a, T>where
T: Unpin,
impl<'a, T> UnwindSafe for Trie<'a, T>where
T: UnwindSafe,
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