| Crates.io | collected |
| lib.rs | collected |
| version | 0.4.0 |
| created_at | 2021-03-27 05:12:47.463835+00 |
| updated_at | 2021-08-29 21:19:48.176963+00 |
| description | Summation, product, maximum and more special collectors for Rust iterators. |
| homepage | https://github.com/jerry73204/rust-collected |
| repository | https://github.com/jerry73204/rust-collected.git |
| max_upload_size | |
| id | 374082 |
| size | 44,185 |
Collection types that takes the maximum, the summation and more from iterators in Rust.
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);
MIT License. See license file.