4 releases (2 stable)

Uses old Rust 2015

2.0.0 Jan 23, 2018
1.0.0 Feb 9, 2017
0.4.1 Oct 9, 2015
0.4.0 Sep 19, 2015

#1698 in Text processing

Download history 103851/week @ 2024-11-16 81851/week @ 2024-11-23 97771/week @ 2024-11-30 95198/week @ 2024-12-07 86375/week @ 2024-12-14 46048/week @ 2024-12-21 57760/week @ 2024-12-28 99125/week @ 2025-01-04 105047/week @ 2025-01-11 96430/week @ 2025-01-18 79444/week @ 2025-01-25 113638/week @ 2025-02-01 96272/week @ 2025-02-08 83386/week @ 2025-02-15 92507/week @ 2025-02-22 78034/week @ 2025-03-01

368,850 downloads per month
Used in 1,297 crates (106 directly)

MIT license

170KB
475 lines

difference.rs

A Rust text diffing library with built-in diffing assertion.

Documentation

Examples

use 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())
]);

Usage

Add the following to your Cargo.toml:

[dependencies]
difference = "2.0"

Now you can use the crate in your code

extern crate difference;

Using the binary

difference can also be used as a command-line application. The best way to install it is using:

$ cargo install --features=bin

Dependencies