#diff #difference #change #assert

bin+lib text-diff

A Rust text diffing and assertion library

2 unstable releases

Uses old Rust 2015

0.4.0 Aug 2, 2015
0.3.0 Jul 10, 2015

#1010 in Text processing

Download history 1639/week @ 2024-03-13 1726/week @ 2024-03-20 1055/week @ 2024-03-27 3127/week @ 2024-04-03 2057/week @ 2024-04-10 4129/week @ 2024-04-17 3135/week @ 2024-04-24 1849/week @ 2024-05-01 2460/week @ 2024-05-08 2994/week @ 2024-05-15 1709/week @ 2024-05-22 3725/week @ 2024-05-29 3224/week @ 2024-06-05 1884/week @ 2024-06-12 2035/week @ 2024-06-19 1506/week @ 2024-06-26

9,299 downloads per month
Used in 7 crates

MIT license

160KB
260 lines

text-diff.rs

A Rust text diffing library.

Documentation

Examples

let (dist, changeset) = diff("test", "tent", "");

assert_eq!(changeset, 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.text_diff]

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

Now you can use the crate in your code

extern crate text_diff;

Using the binary

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

curl -sf https://raw.githubusercontent.com/brson/rustle/master/rustle.sh | sh -s -- https://github.com/johannhof/text-diff.rs

Dependencies

~625KB