Trait slice_group_by::GroupBy
source · [−]pub trait GroupBy<T> {
fn linear_group_by_key<F, K>(&self, func: F) -> LinearGroupByKey<'_, T, F>ⓘNotable traits for LinearGroupByKey<'a, T, F>impl<'a, T: 'a, F, K> Iterator for LinearGroupByKey<'a, T, F> where
F: FnMut(&T) -> K,
K: PartialEq, type Item = &'a [T];
where
F: FnMut(&T) -> K,
K: PartialEq;
fn linear_group_by<P>(&self, predicate: P) -> LinearGroupBy<'_, T, P>ⓘNotable traits for LinearGroupBy<'a, T, P>impl<'a, T: 'a, P> Iterator for LinearGroupBy<'a, T, P> where
P: FnMut(&T, &T) -> bool, type Item = &'a [T];
where
P: FnMut(&T, &T) -> bool;
fn linear_group(&self) -> LinearGroup<'_, T>ⓘNotable traits for LinearGroup<'a, T>impl<'a, T: 'a> Iterator for LinearGroup<'a, T> where
T: PartialEq, type Item = &'a [T];
where
T: PartialEq;
fn binary_group_by_key<F, K>(&self, func: F) -> BinaryGroupByKey<'_, T, F>ⓘNotable traits for BinaryGroupByKey<'a, T, F>impl<'a, T: 'a, F, K> Iterator for BinaryGroupByKey<'a, T, F> where
F: FnMut(&T) -> K,
K: PartialEq, type Item = &'a [T];
where
F: FnMut(&T) -> K,
K: PartialEq;
fn binary_group_by<P>(&self, predicate: P) -> BinaryGroupBy<'_, T, P>ⓘNotable traits for BinaryGroupBy<'a, T, P>impl<'a, T: 'a, P> Iterator for BinaryGroupBy<'a, T, P> where
P: FnMut(&T, &T) -> bool, type Item = &'a [T];
where
P: FnMut(&T, &T) -> bool;
fn binary_group(&self) -> BinaryGroup<'_, T>ⓘNotable traits for BinaryGroup<'a, T>impl<'a, T: 'a> Iterator for BinaryGroup<'a, T> where
T: PartialEq, type Item = &'a [T];
where
T: PartialEq;
fn exponential_group_by_key<F, K>(
&self,
func: F
) -> ExponentialGroupByKey<'_, T, F>ⓘNotable traits for ExponentialGroupByKey<'a, T, F>impl<'a, T: 'a, F, K> Iterator for ExponentialGroupByKey<'a, T, F> where
F: FnMut(&T) -> K,
K: PartialEq, type Item = &'a [T];
where
F: Fn(&T) -> K,
K: PartialEq;
fn exponential_group_by<P>(
&self,
predicate: P
) -> ExponentialGroupBy<'_, T, P>ⓘNotable traits for ExponentialGroupBy<'a, T, P>impl<'a, T: 'a, P> Iterator for ExponentialGroupBy<'a, T, P> where
P: FnMut(&T, &T) -> bool, type Item = &'a [T];
where
P: FnMut(&T, &T) -> bool;
fn exponential_group(&self) -> ExponentialGroup<'_, T>ⓘNotable traits for ExponentialGroup<'a, T>impl<'a, T: 'a> Iterator for ExponentialGroup<'a, T> where
T: PartialEq, type Item = &'a [T];
where
T: PartialEq;
}
Expand description
A convenient trait to construct an iterator returning non-overlapping groups defined by a predicate.
Required methods
fn linear_group_by_key<F, K>(&self, func: F) -> LinearGroupByKey<'_, T, F>ⓘNotable traits for LinearGroupByKey<'a, T, F>impl<'a, T: 'a, F, K> Iterator for LinearGroupByKey<'a, T, F> where
F: FnMut(&T) -> K,
K: PartialEq, type Item = &'a [T];
where
F: FnMut(&T) -> K,
K: PartialEq,
fn linear_group_by_key<F, K>(&self, func: F) -> LinearGroupByKey<'_, T, F>ⓘNotable traits for LinearGroupByKey<'a, T, F>impl<'a, T: 'a, F, K> Iterator for LinearGroupByKey<'a, T, F> where
F: FnMut(&T) -> K,
K: PartialEq, type Item = &'a [T];
where
F: FnMut(&T) -> K,
K: PartialEq,
F: FnMut(&T) -> K,
K: PartialEq, type Item = &'a [T];
Returns an iterator on slice groups based that will use the given function to generate keys and determine groups based on them. It uses linear search to iterate over groups.
fn linear_group_by<P>(&self, predicate: P) -> LinearGroupBy<'_, T, P>ⓘNotable traits for LinearGroupBy<'a, T, P>impl<'a, T: 'a, P> Iterator for LinearGroupBy<'a, T, P> where
P: FnMut(&T, &T) -> bool, type Item = &'a [T];
where
P: FnMut(&T, &T) -> bool,
fn linear_group_by<P>(&self, predicate: P) -> LinearGroupBy<'_, T, P>ⓘNotable traits for LinearGroupBy<'a, T, P>impl<'a, T: 'a, P> Iterator for LinearGroupBy<'a, T, P> where
P: FnMut(&T, &T) -> bool, type Item = &'a [T];
where
P: FnMut(&T, &T) -> bool,
P: FnMut(&T, &T) -> bool, type Item = &'a [T];
Returns an iterator on slice groups using the linear search method.
fn linear_group(&self) -> LinearGroup<'_, T>ⓘNotable traits for LinearGroup<'a, T>impl<'a, T: 'a> Iterator for LinearGroup<'a, T> where
T: PartialEq, type Item = &'a [T];
where
T: PartialEq,
fn linear_group(&self) -> LinearGroup<'_, T>ⓘNotable traits for LinearGroup<'a, T>impl<'a, T: 'a> Iterator for LinearGroup<'a, T> where
T: PartialEq, type Item = &'a [T];
where
T: PartialEq,
T: PartialEq, type Item = &'a [T];
Returns an iterator on slice groups based on the PartialEq::eq
method of T
,
it uses linear search to iterate over groups.
fn binary_group_by_key<F, K>(&self, func: F) -> BinaryGroupByKey<'_, T, F>ⓘNotable traits for BinaryGroupByKey<'a, T, F>impl<'a, T: 'a, F, K> Iterator for BinaryGroupByKey<'a, T, F> where
F: FnMut(&T) -> K,
K: PartialEq, type Item = &'a [T];
where
F: FnMut(&T) -> K,
K: PartialEq,
fn binary_group_by_key<F, K>(&self, func: F) -> BinaryGroupByKey<'_, T, F>ⓘNotable traits for BinaryGroupByKey<'a, T, F>impl<'a, T: 'a, F, K> Iterator for BinaryGroupByKey<'a, T, F> where
F: FnMut(&T) -> K,
K: PartialEq, type Item = &'a [T];
where
F: FnMut(&T) -> K,
K: PartialEq,
F: FnMut(&T) -> K,
K: PartialEq, type Item = &'a [T];
Returns an iterator on slice groups based that will use the given function to generate keys and determine groups based on them. It uses binary search to iterate over groups.
The predicate function should implement an order consistent with the sort order of the slice.
fn binary_group_by<P>(&self, predicate: P) -> BinaryGroupBy<'_, T, P>ⓘNotable traits for BinaryGroupBy<'a, T, P>impl<'a, T: 'a, P> Iterator for BinaryGroupBy<'a, T, P> where
P: FnMut(&T, &T) -> bool, type Item = &'a [T];
where
P: FnMut(&T, &T) -> bool,
fn binary_group_by<P>(&self, predicate: P) -> BinaryGroupBy<'_, T, P>ⓘNotable traits for BinaryGroupBy<'a, T, P>impl<'a, T: 'a, P> Iterator for BinaryGroupBy<'a, T, P> where
P: FnMut(&T, &T) -> bool, type Item = &'a [T];
where
P: FnMut(&T, &T) -> bool,
P: FnMut(&T, &T) -> bool, type Item = &'a [T];
Returns an iterator on slice groups using the binary search method.
The predicate function should implement an order consistent with the sort order of the slice.
fn binary_group(&self) -> BinaryGroup<'_, T>ⓘNotable traits for BinaryGroup<'a, T>impl<'a, T: 'a> Iterator for BinaryGroup<'a, T> where
T: PartialEq, type Item = &'a [T];
where
T: PartialEq,
fn binary_group(&self) -> BinaryGroup<'_, T>ⓘNotable traits for BinaryGroup<'a, T>impl<'a, T: 'a> Iterator for BinaryGroup<'a, T> where
T: PartialEq, type Item = &'a [T];
where
T: PartialEq,
T: PartialEq, type Item = &'a [T];
Returns an iterator on slice groups based on the PartialEq::eq
method of T
,
it uses binary search to iterate over groups.
The predicate function should implement an order consistent with the sort order of the slice.
fn exponential_group_by_key<F, K>(
&self,
func: F
) -> ExponentialGroupByKey<'_, T, F>ⓘNotable traits for ExponentialGroupByKey<'a, T, F>impl<'a, T: 'a, F, K> Iterator for ExponentialGroupByKey<'a, T, F> where
F: FnMut(&T) -> K,
K: PartialEq, type Item = &'a [T];
where
F: Fn(&T) -> K,
K: PartialEq,
fn exponential_group_by_key<F, K>(
&self,
func: F
) -> ExponentialGroupByKey<'_, T, F>ⓘNotable traits for ExponentialGroupByKey<'a, T, F>impl<'a, T: 'a, F, K> Iterator for ExponentialGroupByKey<'a, T, F> where
F: FnMut(&T) -> K,
K: PartialEq, type Item = &'a [T];
where
F: Fn(&T) -> K,
K: PartialEq,
F: FnMut(&T) -> K,
K: PartialEq, type Item = &'a [T];
Returns an iterator on slice groups based that will use the given function to generate keys and determine groups based on them. It uses exponential search to iterate over groups.
The predicate function should implement an order consistent with the sort order of the slice.
fn exponential_group_by<P>(&self, predicate: P) -> ExponentialGroupBy<'_, T, P>ⓘNotable traits for ExponentialGroupBy<'a, T, P>impl<'a, T: 'a, P> Iterator for ExponentialGroupBy<'a, T, P> where
P: FnMut(&T, &T) -> bool, type Item = &'a [T];
where
P: FnMut(&T, &T) -> bool,
fn exponential_group_by<P>(&self, predicate: P) -> ExponentialGroupBy<'_, T, P>ⓘNotable traits for ExponentialGroupBy<'a, T, P>impl<'a, T: 'a, P> Iterator for ExponentialGroupBy<'a, T, P> where
P: FnMut(&T, &T) -> bool, type Item = &'a [T];
where
P: FnMut(&T, &T) -> bool,
P: FnMut(&T, &T) -> bool, type Item = &'a [T];
Returns an iterator on slice groups using the exponential search method.
The predicate function should implement an order consistent with the sort order of the slice.
fn exponential_group(&self) -> ExponentialGroup<'_, T>ⓘNotable traits for ExponentialGroup<'a, T>impl<'a, T: 'a> Iterator for ExponentialGroup<'a, T> where
T: PartialEq, type Item = &'a [T];
where
T: PartialEq,
fn exponential_group(&self) -> ExponentialGroup<'_, T>ⓘNotable traits for ExponentialGroup<'a, T>impl<'a, T: 'a> Iterator for ExponentialGroup<'a, T> where
T: PartialEq, type Item = &'a [T];
where
T: PartialEq,
T: PartialEq, type Item = &'a [T];
Returns an iterator on slice groups based on the PartialEq::eq
method of T
,
it uses exponential search to iterate over groups.
The predicate function should implement an order consistent with the sort order of the slice.
Implementations on Foreign Types
sourceimpl<T> GroupBy<T> for [T]
impl<T> GroupBy<T> for [T]
fn linear_group_by_key<F, K>(&self, func: F) -> LinearGroupByKey<'_, T, F>ⓘNotable traits for LinearGroupByKey<'a, T, F>impl<'a, T: 'a, F, K> Iterator for LinearGroupByKey<'a, T, F> where
F: FnMut(&T) -> K,
K: PartialEq, type Item = &'a [T];
where
F: FnMut(&T) -> K,
K: PartialEq,
F: FnMut(&T) -> K,
K: PartialEq, type Item = &'a [T];
fn linear_group_by<P>(&self, predicate: P) -> LinearGroupBy<'_, T, P>ⓘNotable traits for LinearGroupBy<'a, T, P>impl<'a, T: 'a, P> Iterator for LinearGroupBy<'a, T, P> where
P: FnMut(&T, &T) -> bool, type Item = &'a [T];
where
P: FnMut(&T, &T) -> bool,
P: FnMut(&T, &T) -> bool, type Item = &'a [T];
fn linear_group(&self) -> LinearGroup<'_, T>ⓘNotable traits for LinearGroup<'a, T>impl<'a, T: 'a> Iterator for LinearGroup<'a, T> where
T: PartialEq, type Item = &'a [T];
where
T: PartialEq,
T: PartialEq, type Item = &'a [T];
fn binary_group_by_key<F, K>(&self, func: F) -> BinaryGroupByKey<'_, T, F>ⓘNotable traits for BinaryGroupByKey<'a, T, F>impl<'a, T: 'a, F, K> Iterator for BinaryGroupByKey<'a, T, F> where
F: FnMut(&T) -> K,
K: PartialEq, type Item = &'a [T];
where
F: FnMut(&T) -> K,
K: PartialEq,
F: FnMut(&T) -> K,
K: PartialEq, type Item = &'a [T];
fn binary_group_by<P>(&self, predicate: P) -> BinaryGroupBy<'_, T, P>ⓘNotable traits for BinaryGroupBy<'a, T, P>impl<'a, T: 'a, P> Iterator for BinaryGroupBy<'a, T, P> where
P: FnMut(&T, &T) -> bool, type Item = &'a [T];
where
P: FnMut(&T, &T) -> bool,
P: FnMut(&T, &T) -> bool, type Item = &'a [T];
fn binary_group(&self) -> BinaryGroup<'_, T>ⓘNotable traits for BinaryGroup<'a, T>impl<'a, T: 'a> Iterator for BinaryGroup<'a, T> where
T: PartialEq, type Item = &'a [T];
where
T: PartialEq,
T: PartialEq, type Item = &'a [T];
fn exponential_group_by_key<F, K>(
&self,
func: F
) -> ExponentialGroupByKey<'_, T, F>ⓘNotable traits for ExponentialGroupByKey<'a, T, F>impl<'a, T: 'a, F, K> Iterator for ExponentialGroupByKey<'a, T, F> where
F: FnMut(&T) -> K,
K: PartialEq, type Item = &'a [T];
where
F: Fn(&T) -> K,
K: PartialEq,
F: FnMut(&T) -> K,
K: PartialEq, type Item = &'a [T];
fn exponential_group_by<P>(&self, predicate: P) -> ExponentialGroupBy<'_, T, P>ⓘNotable traits for ExponentialGroupBy<'a, T, P>impl<'a, T: 'a, P> Iterator for ExponentialGroupBy<'a, T, P> where
P: FnMut(&T, &T) -> bool, type Item = &'a [T];
where
P: FnMut(&T, &T) -> bool,
P: FnMut(&T, &T) -> bool, type Item = &'a [T];
fn exponential_group(&self) -> ExponentialGroup<'_, T>ⓘNotable traits for ExponentialGroup<'a, T>impl<'a, T: 'a> Iterator for ExponentialGroup<'a, T> where
T: PartialEq, type Item = &'a [T];
where
T: PartialEq,
T: PartialEq, type Item = &'a [T];