Expand description
Collection types that takes the maximum, the summation and more from iterators.
Every collection type in the crate implements FromIterator
,
Extend
and Default
traits. They can be built from
collect()
, and can be updated by extend()
.
For example, it makes it easy to compute maximum and minimum value from an iterator
using unzip()
in single step.
use collected::{MaxVal, MinVal};
let (min, max): (MinVal<_>, MaxVal<_>) = vec![3, 1, 5, 2, 4, 3, 6]
.into_iter()
.map(|val| (val, val))
.unzip();
assert_eq!(min.unwrap(), 1);
assert_eq!(max.unwrap(), 6);
Structsยง
- AddVal
- A collection that adds up values with
Add
trait. - Count
- A counter that counts witnessed items when collected or extended from an iterator.
- First
- A collection that takes the first item when collected or extended from an iterator.
- From
Unique Hash - A wrapper around a collection
U
that can only be collected or extended from an unique-valued iterator. - From
Unique Ord - A wrapper around a collection
U
that can only be collected or extended from an unique-valued iterator. - Group
Hash Map - A collection that groups the tuples
(key, value)
by key. - Last
- A collection that takes the last item when collected or extended from an iterator.
- LastN
- A wrapper around collection
U
that retains only lastN
values. - MaxVal
- A collection that computes the maximum value.
- MinVal
- A collection that computes the minimum value.
- MulVal
- A collection that multiplies values with
Mul
trait. - Noop
- A collection doing nothing when collected or extended from an iterator.
- Product
Val - A collection taking the product from values with
Product
trait. - SumVal
- A collection taking the summation from values with
Sum
trait. - TopK
- The collection that retains maximum
K
values. - UniqueB
Tree Set - A collection that takes unique values into a BTreeSet.
- Unique
Hash Set - A collection that takes unique values into a HashSet.
- Unique
Index Set - A collection that takes unique values into a IndexSet.
- Uniquify
Hash - A wrapper around a collection
U
that ignores duplicated values from iterator. - Uniquify
Ord - A wrapper around a collection
U
that ignores duplicated values from iterator.