Struct bitcoin::util::patricia_tree::PatriciaTree
[−]
[src]
pub struct PatriciaTree<K: Copy, V> { // some fields omitted }
Patricia troo
Methods
impl<K, V> PatriciaTree<K, V> where K: Copy + BitArray + Eq + Zero + One + BitXor<K, Output=K> + Add<K, Output=K> + Shr<usize, Output=K> + Shl<usize, Output=K>
[src]
fn new() -> PatriciaTree<K, V>
Constructs a new Patricia tree
fn lookup_mut(&mut self, key: &K, key_len: usize) -> Option<&mut V>
Lookup a value by exactly matching key
and return a referenc
fn lookup(&self, key: &K, key_len: usize) -> Option<&V>
Lookup a value by exactly matching key
and return a mutable reference
fn insert(&mut self, key: &K, key_len: usize, value: V) -> bool
Inserts a value with key key
, returning true on success. If a value is already
stored against key
, do nothing and return false.
fn insert_or_update(&mut self, key: &K, key_len: usize, value: V) -> bool
Inserts a value with key key
, returning true on success. If a value is already
stored against key
, overwrite it and return false.
fn delete(&mut self, key: &K, key_len: usize) -> Option<V>
Deletes a value with key key
, returning it on success. If no value with
the given key is found, return None
fn node_count(&self) -> usize
Count all the nodes
fn iter(&self) -> Items<K, V>
Returns an iterator over all elements in the tree
fn mut_iter(&mut self) -> MutItems<K, V>
Returns a mutable iterator over all elements in the tree
Trait Implementations
impl<K: Copy + BitArray, V: Debug> Debug for PatriciaTree<K, V>
[src]
impl<S, K, V> ConsensusEncodable<S> for PatriciaTree<K, V> where S: SimpleEncoder, K: Copy + ConsensusEncodable<S>, V: ConsensusEncodable<S>
[src]
fn consensus_encode(&self, s: &mut S) -> Result<(), S::Error>
Encode an object with a well-defined format
impl<D, K, V> ConsensusDecodable<D> for PatriciaTree<K, V> where D: SimpleDecoder, K: Copy + ConsensusDecodable<D>, V: ConsensusDecodable<D>
[src]
fn consensus_decode(d: &mut D) -> Result<PatriciaTree<K, V>, D::Error>
Decode an object with a well-defined format