#diff #difference #changes #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

#7 in #changes

Download history 323/week @ 2023-06-04 516/week @ 2023-06-11 527/week @ 2023-06-18 762/week @ 2023-06-25 558/week @ 2023-07-02 1549/week @ 2023-07-09 555/week @ 2023-07-16 493/week @ 2023-07-23 505/week @ 2023-07-30 335/week @ 2023-08-06 552/week @ 2023-08-13 432/week @ 2023-08-20 467/week @ 2023-08-27 360/week @ 2023-09-03 355/week @ 2023-09-10 288/week @ 2023-09-17

1,481 downloads per month
Used in 3 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

~260KB