[][src]Function lis::diff_by_key

pub fn diff_by_key<S, T, K: Eq + Hash>(
    a: impl IntoIterator<Item = S, IntoIter = impl DoubleEndedIterator<Item = S>>,
    f: impl FnMut(&S) -> &K,
    b: impl IntoIterator<Item = T, IntoIter = impl DoubleEndedIterator<Item = T>>,
    g: impl FnMut(&T) -> &K,
    cb: &mut impl DiffCallback<S, T>
)

Computes the difference between the two iterators with key extraction functions.

Keys have to be unique. After testing for common prefixes and suffixes, returns removals in forward order and then insertions/moves in reverse order. Guaranteed not to allocate if the changeset is entirely contiguous insertions or removals. Result stores S/T:s instead of indices; use enumerate if preferable.

Panics

May panic if a contains duplicate keys.