Crate text_diff

Source
Expand description

§Functions to find the difference between to texts (strings). Usage

Add the following to your Cargo.toml:

[dependencies.text_diff]

git = "https://github.com/johannhof/text-diff.rs.git"

Now you can use the crate in your code

extern crate text_diff;

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§

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).
diff
Calculates the edit distance and the changeset for two given strings. The first string is assumed to be the “original”, the second to be an edited version of the first. The third parameter specifies how to split the input strings, leading to a more or less exact comparison.
print_diff
Prints a colorful visual representation of the diff. This is just a convenience function for those who want quick results.