collected/
lib.rs

1#![cfg_attr(
2    feature = "unstable",
3    feature(
4        maybe_uninit_uninit_array,
5        maybe_uninit_extra,
6        maybe_uninit_array_assume_init
7    )
8)]
9
10//! Collection types that takes the maximum, the summation and more from iterators.
11//!
12//! Every collection type in the crate implements [`FromIterator`](core::iter::FromIterator),
13//! [`Extend`](core::iter::Extend) and [`Default`](Default) traits. They can be built from
14//! [`collect()`](Iterator::collect), and can be updated by [`extend()`](Extend::extend).
15//!
16//! For example, it makes it easy to compute maximum and minimum value from an iterator
17//! using [`unzip()`](Iterator::unzip) in single step.
18//!
19//! ```rust
20//! use collected::{MaxVal, MinVal};
21//! let (min, max): (MinVal<_>, MaxVal<_>) = vec![3, 1, 5, 2, 4, 3, 6]
22//!     .into_iter()
23//!     .map(|val| (val, val))
24//!     .unzip();
25//! assert_eq!(min.unwrap(), 1);
26//! assert_eq!(max.unwrap(), 6);
27//! ```
28
29mod add;
30mod common;
31mod count;
32#[cfg(feature = "unstable")]
33mod exact_array;
34#[cfg(feature = "unstable")]
35mod fill_array;
36mod first;
37mod from_unique_hash;
38mod from_unique_ord;
39mod group_hash_map;
40mod last;
41mod last_n;
42mod max;
43mod min;
44mod mul;
45mod noop;
46mod product;
47mod sum;
48mod topk;
49mod unique_btree_set;
50mod unique_hash_set;
51#[cfg(feature = "indexmap")]
52mod unique_index_set;
53mod uniquify_hash;
54mod uniquify_ord;
55
56pub use add::*;
57pub use count::*;
58#[cfg(feature = "unstable")]
59pub use exact_array::*;
60#[cfg(feature = "unstable")]
61pub use fill_array::*;
62pub use first::*;
63pub use from_unique_hash::*;
64pub use from_unique_ord::*;
65pub use group_hash_map::*;
66pub use last::*;
67pub use last_n::*;
68pub use max::*;
69pub use min::*;
70pub use mul::*;
71pub use noop::*;
72pub use product::*;
73pub use sum::*;
74pub use topk::*;
75pub use unique_btree_set::*;
76pub use unique_hash_set::*;
77#[cfg(feature = "indexmap")]
78pub use unique_index_set::*;
79pub use uniquify_hash::*;
80pub use uniquify_ord::*;