Crate difference_rs

Source
Expand description

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

§Usage

Add the following to your Cargo.toml:

[dependencies]
difference_rs = "3.0"

Now you can use the crate in your code

§Examples

See Examples.md for more examples.

use difference_rs::{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
ChangesetMulti
The information about a full changeset when regarding a multi split 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