3 releases

0.1.2 May 31, 2023
0.1.1 May 29, 2023
0.1.0 May 29, 2023

#2190 in Algorithms

37 downloads per month

Apache-2.0

11KB
252 lines

more-iter

More iterating utilities in rust

MergePair

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);

No runtime deps