[−][src]Trait hat_trie::TrieNode
Required methods
fn new_split(bucket: ArrayHash<XxHash64, Box<[K]>, V>) -> Self
Construct a new trie node from a bucket of pure node. This happen whenever burst or split threshold reach. It consume a given bucket and return a new Trie node which contains splitted bucket as childs.
fn child(&self, key: &K) -> &NodeType<K, Self, V>
Get a child node of given key from current node.
fn value(&self) -> Option<&V>
Retrieve a value of current node.
fn value_mut(&mut self) -> &mut Option<V>
Retrieve a mutable value of current node.
fn put(&mut self, key: &[K], value: V) -> Option<V>
Put value into this trie node.
If key is already exist in this trie, it replace existing entry with give key/value and return existing value to caller.
fn try_put<'a>(&'a mut self, key: &[K], value: V) -> Option<&'a V> where
K: 'a,
K: 'a,
Try putting value into this trie.
If key is already exist in this trie, it will return existing value to caller without any change to the trie.
Provided methods
fn get<'a>(&'a self, key: &[K]) -> Option<&'a V> where
K: 'a,
K: 'a,
Get a value from this trie associated with given key slice.
fn prefix<'a, 'b>(&'a self, key: &'b [K]) -> PrefixIterator<'a, 'b, K, Self, V>
Find all possible prefix in given key that match with this trie node.
Parameter
key
- a slice of key to find a prefix.
Return
It return PrefixIterator which can be used to access tuple of prefix slice and value of node in this trie.
fn longest_prefix<'a, 'b>(&'a self, key: &'b [K]) -> Option<(&'b [K], &'a V)> where
K: 'a,
K: 'a,
Find a longest prefix from given key from this Trie.
This is a utility function that perform exactly like you iterate on method prefix to find a longest prefix by yourself.
Implementors
impl<K, V> TrieNode<K, V> for DenseVecTrieNode<K, V> where
K: AsPrimitive<usize> + Bounded + Copy + Debug + Hash + FromPrimitive + PartialEq + PartialOrd + Sized + Unsigned,
Box<[K]>: Clone + PartialEq,
V: Clone + Default,
[src]
K: AsPrimitive<usize> + Bounded + Copy + Debug + Hash + FromPrimitive + PartialEq + PartialOrd + Sized + Unsigned,
Box<[K]>: Clone + PartialEq,
V: Clone + Default,
fn new_split(bucket: ArrayHash<XxHash64, Box<[K]>, V>) -> Self
[src]
fn child<'a>(&'a self, key: &K) -> &'a NodeType<K, Self, V>
[src]
fn value(&self) -> Option<&V>
[src]
fn value_mut(&mut self) -> &mut Option<V>
[src]
fn put(&mut self, key: &[K], value: V) -> Option<V>
[src]
fn try_put<'a>(&'a mut self, key: &[K], value: V) -> Option<&'a V> where
K: 'a,
[src]
K: 'a,