pub struct Map<K: 'static + Label, V: AsHashTree + 'static> { /* private fields */ }Implementations§
Source§impl<K: 'static + Label, V: AsHashTree + 'static> Map<K, V>
impl<K: 'static + Label, V: AsHashTree + 'static> Map<K, V>
pub fn new() -> Self
Sourcepub fn insert(&mut self, key: K, value: V) -> Option<V>
pub fn insert(&mut self, key: K, value: V) -> Option<V>
Insert a key-value pair into the map. Returns None if the key did not
exists in the map, otherwise the previous value associated with the provided
key will be returned.
Sourcepub fn remove<Q>(&mut self, key: &Q) -> Option<V>
pub fn remove<Q>(&mut self, key: &Q) -> Option<V>
Remove the value associated with the given key from the map, returns the previous value associated with the key.
Sourcepub fn remove_entry<Q>(&mut self, key: &Q) -> Option<(K, V)>
pub fn remove_entry<Q>(&mut self, key: &Q) -> Option<(K, V)>
Remove an entry from the map and return the key and value.
pub fn entry(&mut self, key: K) -> Entry<'_, K, V>
Sourcepub fn get_mut<Q>(&mut self, key: &Q) -> Option<&mut V>
pub fn get_mut<Q>(&mut self, key: &Q) -> Option<&mut V>
Returns a mutable reference to the value corresponding to the key.
Sourcepub fn iter(&self) -> RbTreeIterator<'_, K, V> ⓘ
pub fn iter(&self) -> RbTreeIterator<'_, K, V> ⓘ
Return an iterator over the key-values in the map.
Sourcepub fn witness<Q>(&self, key: &Q) -> HashTree<'_>
pub fn witness<Q>(&self, key: &Q) -> HashTree<'_>
Create a HashTree witness for the value associated with given key.
Sourcepub fn witness_keys(&self) -> HashTree<'_>
pub fn witness_keys(&self) -> HashTree<'_>
Returns a witness enumerating all the keys in this map. The resulting tree doesn’t include values, they are replaced with “Pruned” nodes.
Sourcepub fn witness_value_range<Q1, Q2>(&self, first: &K, last: &K) -> HashTree<'_>
pub fn witness_value_range<Q1, Q2>(&self, first: &K, last: &K) -> HashTree<'_>
Returns a witness for the key-value pairs in the specified range. The resulting tree contains both keys and values.
Sourcepub fn witness_key_range<Q1, Q2>(&self, first: &K, last: &K) -> HashTree<'_>
pub fn witness_key_range<Q1, Q2>(&self, first: &K, last: &K) -> HashTree<'_>
Returns a witness for the keys in the specified range. The resulting tree only contains the keys, and the values are replaced with “Pruned” nodes.
Sourcepub fn witness_keys_with_prefix<P>(&self, prefix: &P) -> HashTree<'_>
pub fn witness_keys_with_prefix<P>(&self, prefix: &P) -> HashTree<'_>
Returns a witness for the keys with the given prefix, this replaces the values with “Pruned” nodes.
Source§impl<K: 'static + Label, V: AsHashTree> Map<K, Seq<V>>
impl<K: 'static + Label, V: AsHashTree> Map<K, Seq<V>>
Sourcepub fn append_deep(&mut self, key: K, value: V)
pub fn append_deep(&mut self, key: K, value: V)
Perform a Seq::append on the seq associated with the give value, if
the seq does not exists, creates an empty one and inserts it to the map.