Function seqdiff::diff[][src]

pub fn diff<A: PartialEq<B>, B>(a: &[A], b: &[B]) -> (Diff, Diff)

Returns the correspondence between two sequences.

The return value is a pair of tuples. The first tuple contains the index where the item from the first sequence appears in the 2nd sequence or None if the item doesn’t appear in the 2nd sequence. The 2nd tuple is the same but listing the corresponding indexes for the 2nd sequence in the first sequence.

Examples

use seqdiff;
let (a2b, b2a) = seqdiff::diff(&[1, 2, 3], &[1, 3]);
assert_eq!(a2b, vec![Some(0), None, Some(1)]);
assert_eq!(b2a, vec![Some(0), Some(2)]);