Trait InsertAndIncrement

Source
pub trait InsertAndIncrement<K, V>: Default {
    // Required method
    fn insert_and_increment(&mut self, key: K, value: V);
}
Expand description

A trait for mapping types to serve as a trivial wrapper over the Entry interface

Required Methods§

Source

fn insert_and_increment(&mut self, key: K, value: V)

Creates collection with the given key if necessary and increments its total by the given value

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.

Implementations on Foreign Types§

Source§

impl<K, V> InsertAndIncrement<K, V> for BTreeMap<K, V>
where K: Ord, V: AddAssign,

Source§

fn insert_and_increment(&mut self, key: K, value: V)

Source§

impl<K, V, H> InsertAndIncrement<K, V> for HashMap<K, V, H>
where K: Eq + Hash, V: AddAssign, H: BuildHasher + Default,

Source§

fn insert_and_increment(&mut self, key: K, value: V)

Implementors§