Skip to main content

GroupByOwned

Trait GroupByOwned 

Source
pub trait GroupByOwned {
    type Item;

    // Required method
    fn group_by_owned<F, K>(
        self,
        key_selector: F,
    ) -> HashMap<K, Vec<Self::Item>>
       where F: FnMut(&Self::Item) -> K,
             K: Hash + Eq;
}
Expand description

Groups items into owned vectors keyed by a selector result.

Required Associated Types§

Required Methods§

Source

fn group_by_owned<F, K>(self, key_selector: F) -> HashMap<K, Vec<Self::Item>>
where F: FnMut(&Self::Item) -> K, K: Hash + Eq,

Consumes the vector and groups its items by key_selector.

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> GroupByOwned for Vec<T>

Source§

type Item = T

Source§

fn group_by_owned<F, K>(self, key_selector: F) -> HashMap<K, Vec<T>>
where F: FnMut(&T) -> K, K: Hash + Eq,

Implementors§