MergeCollection

Trait MergeCollection 

Source
pub trait MergeCollection<Key, Value> {
    // Required method
    fn merge_collection(
        self,
        other: impl IntoIterator<Item = (Key, Value)>,
        action: impl Fn(Value, Value) -> Value,
    ) -> Self;
}

Required Methods§

Source

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

Returns a collection which contains the combination by using action 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: Eq, Value: HasZero + Clone + Eq> MergeCollection<Key, Value> for SmallOrderedMap<Key, Value>

Available on crate feature std only.
Source§

impl<Key: Hash + Eq, Value: HasZero + Clone + Eq, BH: BuildHasher> MergeCollection<Key, Value> for OrderedHashMap<Key, Value, BH>