pub struct Trie<TK: PartialEq + AsRef<[u8]>, TV> { /* private fields */ }
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.
Trait Implementations§
Auto Trait Implementations§
impl<TK, TV> RefUnwindSafe for Trie<TK, TV>where
TK: RefUnwindSafe,
TV: RefUnwindSafe,
impl<TK, TV> Send for Trie<TK, TV>
impl<TK, TV> Sync for Trie<TK, TV>
impl<TK, TV> Unpin for Trie<TK, TV>
impl<TK, TV> UnwindSafe for Trie<TK, TV>where
TK: UnwindSafe,
TV: 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