iter-diff 0.1.1

Differences between iterators
Documentation
  • Coverage
  • 100%
    10 out of 10 items documented3 out of 6 items with examples
  • Size
  • Source code size: 21.05 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.85 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Homepage
  • ureeves/iter-diff
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • ureeves

iter-diff

Differences between iterators

CI codecov docs.rs


The IterDiff trait can be used to iterate through the differences between two iterators. The differences between each element are enumerated by Diff. The variants of the enum express the changes one would need to make to the left-hand iterator in order to attain the right-hand iterator.

use iter_diff::prelude::*;

let a = [0, 1, 2, 3];
let b = [0, 2, 2];

let diffs: Vec<_> = a.iter_diff(b).collect();
assert_eq!(diffs.len(), 4);

assert_eq!(diffs[0], Diff::Keep);
assert_eq!(diffs[1], Diff::Change(2));
assert_eq!(diffs[2], Diff::Keep);
assert_eq!(diffs[3], Diff::Remove);