Struct qptrie::Trie
[−]
[src]
pub struct Trie<TK: PartialEq + AsRef<[u8]>, TV> { /* fields omitted */ }
A qp-trie.
Methods
impl<TK: PartialEq + AsRef<[u8]>, TV> Trie<TK, TV>
[src]
fn new() -> Self
Creates a new, empty qp-trie.
fn max_height(self, max_height: usize) -> Self
Refuses to insert nodes that would make the trie height greater than max_height
.
fn is_empty(&self) -> bool
Returns true
if the trie is empty.
fn insert(&mut self, key: TK, val: TV) -> bool
Inserts a new node with the key key
.
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.
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.
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.
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.
Trait Implementations
impl<TK: Clone + PartialEq + AsRef<[u8]>, TV: Clone> Clone for Trie<TK, TV>
[src]
fn clone(&self) -> Trie<TK, TV>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more