itertools

Function diff_with

Source
pub fn diff_with<I, J, F>(
    i: I,
    j: J,
    is_equal: F,
) -> Option<Diff<I::IntoIter, J::IntoIter>>
where I: IntoIterator, J: IntoIterator, F: FnMut(&I::Item, &J::Item) -> bool,
Expand description

Compares every element yielded by both i and j with the given function in lock-step and returns a Diff which describes how j differs from i.

If the number of elements yielded by j is less than the number of elements yielded by i, the number of j elements yielded will be returned along with i’s remaining elements as Diff::Shorter.

If the two elements of a step differ, the index of those elements along with the remaining elements of both i and j are returned as Diff::FirstMismatch.

If i becomes exhausted before j becomes exhausted, the number of elements in i along with the remaining j elements will be returned as Diff::Longer.