Make the change type be generic over any T rather &T (#31)
This makes the interface of this crate more flexible as the utility methods such as `iter_changes` now also work if a container does not contain references.
This commit is contained in:
parent
0b8e237280
commit
a3e10af892
7 changed files with 75 additions and 37 deletions
13
examples/nonstring.rs
Normal file
13
examples/nonstring.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use similar::{capture_diff_slices, Algorithm};
|
||||
|
||||
fn main() {
|
||||
let old = vec![1, 2, 3];
|
||||
let new = vec![1, 2, 4];
|
||||
let ops = capture_diff_slices(Algorithm::Myers, &old, &new);
|
||||
|
||||
for op in ops {
|
||||
for change in op.iter_changes(&old, &new) {
|
||||
println!("{:?}", change);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue