elipdotter::set

Function progressive

source
pub fn progressive<T, L, R, C, M>(
    a: L,
    b: R,
    comparison: C,
    matches: M,
    minimize_dist_right: Option<fn(_: &T, _: &T) -> usize>,
) -> impl Iterator<Item = Inclusion<T>>
where T: Clone, L: IntoIterator<Item = T>, R: IntoIterator<Item = T>, C: FnMut(&mut T, &mut T) -> Ordering, M: FnMut(&T, &T) -> Ordering,
Expand description

Like iter_set::classify but when we get two “equal” from matches, we let one of those stay in the “cache” to match future ones. The last one or the greatest one according to comparison stays.

If minimize_dist_right is Some, the algorithm will only return Inclusion::Both once b is close to a as possible. It should return the distance between the two points (using the same algorithm as comparison). This is very useful when doing AND NOT operations. Set it to None otherwise.