Crates.io | more-iter |
lib.rs | more-iter |
version | 0.1.2 |
source | src |
created_at | 2023-05-29 07:25:00.638456 |
updated_at | 2023-05-31 05:45:30.209698 |
description | More iterator utilities |
homepage | https://github.com/drmingdrmer/more-iter |
repository | https://github.com/drmingdrmer/more-iter |
max_upload_size | |
id | 876982 |
size | 26,246 |
More iterating utilities in rust
Merge two (key, value)
iterators by key, keeping the largest value:
use more_iter::MergePair;
let a = [(1, 10), (3, 30), (4, 40)];
let b = [(2, 200), (3, 300)];
let merged = MergePair::merge(a, b, std::cmp::max).collect::<Vec<_>>();
assert_eq!(vec![(1, 10), (2, 200), (3, 300), (4, 40)], merged);