Liff 🍃
Compute the diff between two vectors with the Levenshtein algorithm.
Faster than other crate. Try cargo bench
to see the difference.
Usage
Levenshtein is a O(n1n2) time complexty and in space so you don't want to use it with a big raw. But you can use it with good chunks or text content!
let from: = input_text_from.as_bytes.into;
let to: = input_text_to.as_bytes.into;
let diff = ;
Use the diff output
The diff output can be used as a patch from another part of your code.
let res = apply;
// res should be equals to "to"
Write temporary a compressed patch
the diff patch is quite bigger than we can do. You can compress it and that's what we do when we dump a file. You can read and write a diff with these functions.
;
let diff = read;
write