[−][src]Crate difference
Functions to find the difference between two texts (strings). Usage
Add the following to your Cargo.toml
:
[dependencies]
difference = "2.0"
Now you can use the crate in your code
ⓘThis example is not tested
extern crate difference;
Examples
See Examples.md for more examples.
use difference::{Difference, Changeset}; let changeset = Changeset::new("test", "tent", ""); assert_eq!(changeset.diffs, vec![ Difference::Same("te".to_string()), Difference::Rem("s".to_string()), Difference::Add("n".to_string()), Difference::Same("t".to_string()) ]);
Macros
assert_diff | Assert the difference between two strings. Works like diff, but takes a fourth parameter that is the expected edit distance (e.g. 0 if you want to test for equality). |
Structs
Changeset | The information about a full changeset |
Enums
Difference | Defines the contents of a changeset Changesets will be delivered in order of appearance in the original string Sequences of the same kind will be grouped into one Difference |
Functions
diff | Deprecated This function is deprecated, please use |
print_diff | Deprecated This function is deprecated, |