[][src]Function seqdiff::diff_by

pub fn diff_by<A, B, F>(a: &[A], b: &[B], cmp: F) -> (Diff, Diff) where
    F: Fn(&A, &B) -> bool

Returns the correspondence between two sequences with a comparison function.

Examples

use seqdiff;
let nan_eq = |a: &f64, b: &f64| if a.is_nan() && b.is_nan() { true } else { a == b };
let (a2b, b2a) = seqdiff::diff_by(&[1., 2., f64::NAN], &[1., f64::NAN], nan_eq);
assert_eq!(a2b, vec![Some(0), None, Some(1)]);
assert_eq!(b2a, vec![Some(0), Some(2)]);