AddCollection

Trait AddCollection 

Source
pub trait AddCollection<Key, Value> {
    // Required method
    fn add_collection(
        self,
        other: impl IntoIterator<Item = (Key, Value)>,
    ) -> Self;
}
Expand description

A trait for types which support addition on collections.

Required Methods§

Source

fn add_collection(self, other: impl IntoIterator<Item = (Key, Value)>) -> Self

Returns a new collection with the sum of the values from the given two collections, for each key.

If the key is missing from one of them, it is treated as zero.

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<Key, Value: Add<Output = Value>, T: MergeCollection<Key, Value>> AddCollection<Key, Value> for T