Trait MergeByKey

Source
pub trait MergeByKey {
    type Elem;

    // Required method
    fn merge_by_key<F, K>(&mut self, template: &Self, get_key: F)
       where F: FnMut(&Self::Elem) -> K,
             K: Hash + Eq;
}
Expand description

Merge the elements in two containers using a custom function for getting the key that should be used for each element. This allows merging Vec.

Required Associated Types§

Required Methods§

Source

fn merge_by_key<F, K>(&mut self, template: &Self, get_key: F)
where F: FnMut(&Self::Elem) -> K, K: Hash + Eq,

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<T> MergeByKey for Option<T>
where T: MergeByKey + Clone,

Source§

type Elem = <T as MergeByKey>::Elem

Source§

fn merge_by_key<F, K>(&mut self, template: &Self, get_key: F)
where F: FnMut(&Self::Elem) -> K, K: Hash + Eq,

Source§

impl<T> MergeByKey for Vec<T>
where T: Merge,

Source§

type Elem = T

Source§

fn merge_by_key<F, K>(&mut self, template: &Self, get_key: F)
where F: FnMut(&Self::Elem) -> K, K: Hash + Eq,

Implementors§