pub struct TrieNode<K: Eq + Ord + Clone, V> {
pub value: Option<V>,
pub children: Vec<(K, TrieNode<K, V>)>,
}Expand description
A node in the Trie, it holds a value, and a list of children nodes
Fields§
§value: Option<V>§children: Vec<(K, TrieNode<K, V>)>sorted
Implementations§
Source§impl<K: Eq + Ord + Clone, V> TrieNode<K, V>
impl<K: Eq + Ord + Clone, V> TrieNode<K, V>
pub fn new() -> Self
Sourcepub fn insert<I: Iterator<Item = (usize, K)>>(
&mut self,
key: I,
value_cb: impl FnMut(&mut TrieNode<K, V>, Option<usize>),
cur: Option<usize>,
) -> Option<&mut V>
pub fn insert<I: Iterator<Item = (usize, K)>>( &mut self, key: I, value_cb: impl FnMut(&mut TrieNode<K, V>, Option<usize>), cur: Option<usize>, ) -> Option<&mut V>
Insert a node in the trie
pub fn remove_subtree<I: Iterator<Item = K>>(&mut self, key: Peekable<I>)
Sourcepub fn find_node<I: Iterator<Item = K>>(&self, key: I) -> Option<&Self>
pub fn find_node<I: Iterator<Item = K>>(&self, key: I) -> Option<&Self>
Recursively find a node searching through children
pub fn find_node_mut<I: Iterator<Item = K>>( &mut self, key: I, ) -> Option<&mut Self>
pub fn set_value(&mut self, value: V)
pub fn get_value(&self) -> Option<&V>
pub fn may_be_leaf(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl<K, V> Freeze for TrieNode<K, V>where
V: Freeze,
impl<K, V> RefUnwindSafe for TrieNode<K, V>where
V: RefUnwindSafe,
K: RefUnwindSafe,
impl<K, V> Send for TrieNode<K, V>
impl<K, V> Sync for TrieNode<K, V>
impl<K, V> Unpin for TrieNode<K, V>
impl<K, V> UnsafeUnpin for TrieNode<K, V>where
V: UnsafeUnpin,
impl<K, V> UnwindSafe for TrieNode<K, V>where
V: UnwindSafe,
K: 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