Struct casper_execution_engine::shared::additive_map::AdditiveMap
source · pub struct AdditiveMap<K, V, S = RandomState>(/* private fields */);Expand description
An associative container that looks and works like a normal HashMap except that, instead of
overwriting existing items, it adds the new value to the existing value.
Implementations§
source§impl<K: Eq + Hash, V> AdditiveMap<K, V, RandomState>
impl<K: Eq + Hash, V> AdditiveMap<K, V, RandomState>
source§impl<K: Eq + Hash, V: AddAssign + Default, S: BuildHasher> AdditiveMap<K, V, S>
impl<K: Eq + Hash, V: AddAssign + Default, S: BuildHasher> AdditiveMap<K, V, S>
sourcepub fn insert_add(&mut self, key: K, value_to_add: V)
pub fn insert_add(&mut self, key: K, value_to_add: V)
Modifies the existing value stored under key, or the default value for V if none, by
adding value_to_add.
source§impl<K, V, S> AdditiveMap<K, V, S>
impl<K, V, S> AdditiveMap<K, V, S>
sourcepub fn keys(&self) -> Keys<'_, K, V>
pub fn keys(&self) -> Keys<'_, K, V>
An iterator visiting all keys in arbitrary order. The iterator element type is &'a K.
sourcepub fn values(&self) -> Values<'_, K, V>
pub fn values(&self) -> Values<'_, K, V>
An iterator visiting all values in arbitrary order. The iterator element type is &'a V.
source§impl<K: Eq + Hash, V, S: BuildHasher> AdditiveMap<K, V, S>
impl<K: Eq + Hash, V, S: BuildHasher> AdditiveMap<K, V, S>
sourcepub fn get<Q>(&self, key: &Q) -> Option<&V>
pub fn get<Q>(&self, key: &Q) -> Option<&V>
Returns a reference to the value corresponding to a key.
sourcepub fn insert(&mut self, key: K, value: V) -> Option<V>
pub fn insert(&mut self, key: K, value: V) -> Option<V>
Inserts a key-value pair into the map.
If the map did not have this key present, None is returned.
If the map did have this key present, the value is updated, and the old value is returned.
Trait Implementations§
source§impl<K: Clone, V: Clone, S: Clone> Clone for AdditiveMap<K, V, S>
impl<K: Clone, V: Clone, S: Clone> Clone for AdditiveMap<K, V, S>
source§fn clone(&self) -> AdditiveMap<K, V, S>
fn clone(&self) -> AdditiveMap<K, V, S>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl<K: Eq + Hash + Debug, V: Debug, S: BuildHasher> Debug for AdditiveMap<K, V, S>
impl<K: Eq + Hash + Debug, V: Debug, S: BuildHasher> Debug for AdditiveMap<K, V, S>
source§impl<K: Eq + Hash, V, S: BuildHasher + Default> Default for AdditiveMap<K, V, S>
impl<K: Eq + Hash, V, S: BuildHasher + Default> Default for AdditiveMap<K, V, S>
source§impl From<ExecutionJournal> for AdditiveMap<Key, Transform>
impl From<ExecutionJournal> for AdditiveMap<Key, Transform>
source§fn from(journal: ExecutionJournal) -> Self
fn from(journal: ExecutionJournal) -> Self
Converts to this type from the input type.
source§impl<K: Eq + Hash, V, S: BuildHasher + Default> FromIterator<(K, V)> for AdditiveMap<K, V, S>
impl<K: Eq + Hash, V, S: BuildHasher + Default> FromIterator<(K, V)> for AdditiveMap<K, V, S>
source§impl<K, Q, V, S> Index<&Q> for AdditiveMap<K, V, S>
impl<K, Q, V, S> Index<&Q> for AdditiveMap<K, V, S>
source§impl<'a, K, V, S> IntoIterator for &'a AdditiveMap<K, V, S>
impl<'a, K, V, S> IntoIterator for &'a AdditiveMap<K, V, S>
source§impl<'a, K, V, S> IntoIterator for &'a mut AdditiveMap<K, V, S>
impl<'a, K, V, S> IntoIterator for &'a mut AdditiveMap<K, V, S>
source§impl<K, V, S> IntoIterator for AdditiveMap<K, V, S>
impl<K, V, S> IntoIterator for AdditiveMap<K, V, S>
source§impl<K: Eq + Hash, V: PartialEq, S: BuildHasher> PartialEq for AdditiveMap<K, V, S>
impl<K: Eq + Hash, V: PartialEq, S: BuildHasher> PartialEq for AdditiveMap<K, V, S>
source§fn eq(&self, other: &AdditiveMap<K, V, S>) -> bool
fn eq(&self, other: &AdditiveMap<K, V, S>) -> bool
This method tests for
self and other values to be equal, and is used
by ==.impl<K: Eq + Hash, V: Eq, S: BuildHasher> Eq for AdditiveMap<K, V, S>
Auto Trait Implementations§
impl<K, V, S> RefUnwindSafe for AdditiveMap<K, V, S>
impl<K, V, S> Send for AdditiveMap<K, V, S>
impl<K, V, S> Sync for AdditiveMap<K, V, S>
impl<K, V, S> Unpin for AdditiveMap<K, V, S>
impl<K, V, S> UnwindSafe for AdditiveMap<K, V, S>
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.