radix_trie

Trait TrieCommon

Source
pub trait TrieCommon<'a, K, V: 'a>: ContainsTrieNode<'a, K, V>
where K: TrieKey + 'a, Self: Sized,
{ // Required methods fn len(self) -> usize; fn children(self) -> Children<'a, K, V> ; // Provided methods fn key(self) -> Option<&'a K> { ... } fn value(self) -> Option<&'a V> { ... } fn is_empty(self) -> bool { ... } fn is_leaf(self) -> bool { ... } fn iter(self) -> Iter<'a, K, V> { ... } fn keys(self) -> Keys<'a, K, V> { ... } fn values(self) -> Values<'a, K, V> { ... } fn prefix(self) -> &'a Nibblet { ... } }
Expand description

Common functionality available for tries and subtries.

Required Methods§

Source

fn len(self) -> usize

Number of key/value pairs stored in this trie.

Source

fn children(self) -> Children<'a, K, V>

Return an iterator over the child subtries of this node.

Provided Methods§

Source

fn key(self) -> Option<&'a K>

Get the key stored at this node, if any.

Source

fn value(self) -> Option<&'a V>

Get the value stored at this node, if any.

Source

fn is_empty(self) -> bool

Determine if the Trie contains 0 key-value pairs.

Source

fn is_leaf(self) -> bool

Determine if the trie is a leaf node (has no children).

Source

fn iter(self) -> Iter<'a, K, V>

Return an iterator over the keys and values of the Trie.

Source

fn keys(self) -> Keys<'a, K, V>

Return an iterator over the keys of the Trie.

Source

fn values(self) -> Values<'a, K, V>

Return an iterator over the values of the Trie.

Source

fn prefix(self) -> &'a Nibblet

Get the prefix of this node.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<'a, K, V: 'a> TrieCommon<'a, K, V> for &'a Trie<K, V>
where K: TrieKey + 'a,

Source§

impl<'a, K, V: 'a> TrieCommon<'a, K, V> for SubTrieMut<'a, K, V>
where K: TrieKey + 'a,

Source§

impl<'a: 'b, 'b, K, V: 'a> TrieCommon<'a, K, V> for &'b SubTrie<'a, K, V>
where K: TrieKey + 'a,

Source§

impl<'a: 'b, 'b, K, V: 'a> TrieCommon<'b, K, V> for &'b SubTrieMut<'a, K, V>
where K: TrieKey + 'a,