[][src]Trait grouping_by::GroupingBy

pub trait GroupingBy {
    type GItem;
    fn grouping_by<K, F>(self, key: F) -> HashMap<K, Vec<Self::GItem>>
    where
        Self: Sized,
        F: Fn(&Self::GItem) -> K,
        K: Eq + Hash
;
fn grouping_by_as_set<K, F>(
        self,
        key: F
    ) -> HashMap<K, HashSet<Self::GItem>>
    where
        Self: Sized,
        Self::GItem: Eq + Hash,
        F: Fn(&Self::GItem) -> K,
        K: Eq + Hash
; }

Associated Types

type GItem

Loading content...

Required methods

fn grouping_by<K, F>(self, key: F) -> HashMap<K, Vec<Self::GItem>> where
    Self: Sized,
    F: Fn(&Self::GItem) -> K,
    K: Eq + Hash

Group by the key function given as parameter. The keys are the different values that the function can return, and the values are a Vec with the items of the iterator which has the key as property

fn grouping_by_as_set<K, F>(self, key: F) -> HashMap<K, HashSet<Self::GItem>> where
    Self: Sized,
    Self::GItem: Eq + Hash,
    F: Fn(&Self::GItem) -> K,
    K: Eq + Hash

Group by the key function given as parameter. The keys are the different values that the function can return, and the values are a HashSet with the items of the iterator which has the key as property

Loading content...

Implementors

impl<T: Iterator> GroupingBy for T[src]

type GItem = <T as Iterator>::Item

Loading content...