difference 0.4.1

A Rust text diffing and assertion library.

Crate difference [] [src]

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

Usage

Add the following to your Cargo.toml:

[dependencies]
difference = "0.4"

Now you can use the crate in your code

extern crate difference;

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.