Compute the differences between two states.
use changes::diff;
let current = vec![ 1, 2, 3 ];
let desired = vec![ 1, 2, 3, 4 ];
let diff = diff(current, desired);
println!("{:?}", diff);
// => [
// Ops::Noop(0), // Don't do anything at index 0
// Ops::Noop(1), // Don't do anything at index 0
// Ops::Noop(2), // Don't do anything at index 0
// Ops::Move(3, 3), // Move value from index 3 to current index 3
// Ops::Done, // End
// ]
$ cargo add changes
This crate uses #![deny(unsafe_code)]
to ensure everything is implemented in
100% Safe Rust.
Want to join us? Check out our "Contributing" guide and take a look at some of these issues:
- James Coglan - The Myers diff algorithm: part 1
- James Coglan - The Myers diff algorithm: part 2
- James Coglan - The Myers diff algorithm: part 3
- James Coglan - Myers diff in linear space: theory
- James Coglan - Myers diff in linear space: implementation
- James Coglan - The patience diff algorithm
- James Coglan - Implementing patience diff
MIT OR Apache-2.0