pub fn deduplicate_by_keep_fn<T: PartialEq, I: Iterator<Item = T>, F: Fn(T, T) -> T>(
    iter: I,
    chooser: F
) -> Deduplicate<T, I, F> 
Expand description

Removes consecutive duplicate items.

If duplicate items are detected, the chooser callback decides which of them to keep.

This works best for sorted iterators (e.g. std::collections::BTreeMap::iter) as they always have any duplicate items right after each other.