Expand description
A qp-trie.
Implementations§
source§impl<TK: PartialEq + AsRef<[u8]>, TV> Trie<TK, TV>
impl<TK: PartialEq + AsRef<[u8]>, TV> Trie<TK, TV>
sourcepub fn max_height(self, max_height: usize) -> Self
pub fn max_height(self, max_height: usize) -> Self
Refuses to insert nodes that would make the trie height greater than max_height
.
sourcepub fn get(&self, key: &TK) -> Option<&TV>
pub fn get(&self, key: &TK) -> Option<&TV>
Returns the value associated with the key key
, or None
if the key is not present in the trie.
sourcepub fn get_mut(&mut self, key: &TK) -> Option<&mut TV>
pub fn get_mut(&mut self, key: &TK) -> Option<&mut TV>
Returns a mutable value associated with the key key
, or None
if the key is not present in the trie.
sourcepub fn remove(&mut self, key: &TK) -> bool
pub fn remove(&mut self, key: &TK) -> bool
Removes the node associated with the key key
.
Returns true
if the key was found, or false
if the operation was a no-op.
sourcepub fn prefix_iter<'t>(
&'t self,
prefix: &'t TK
) -> TriePrefixIterator<'_, TK, TV> ⓘ
pub fn prefix_iter<'t>(
&'t self,
prefix: &'t TK
) -> TriePrefixIterator<'_, TK, TV> ⓘ
Creates a new iterator over all the nodes whose key includes prefix
as a prefix.