12 releases

0.1.11 Nov 16, 2017
0.1.10 Mar 2, 2017
0.1.9 Feb 4, 2016
0.1.8 Dec 26, 2015
0.1.4 Jul 27, 2015
Download history 14157/week @ 2019-07-05 12140/week @ 2019-07-12 12330/week @ 2019-07-19 13867/week @ 2019-07-26 12934/week @ 2019-08-02 14350/week @ 2019-08-09 13308/week @ 2019-08-16 12838/week @ 2019-08-23 13668/week @ 2019-08-30 13952/week @ 2019-09-06 15191/week @ 2019-09-13 15200/week @ 2019-09-20 15603/week @ 2019-09-27 15343/week @ 2019-10-04 17187/week @ 2019-10-11

67,186 downloads per month
Used in 265 crates (39 directly)

MIT/Apache

9KB
102 lines

diff.rs

An LCS based slice and string diffing implementation.

Example

extern crate diff;

fn main() {
    let left = "foo\nbar\nbaz\nquux";
    let right = "foo\nbaz\nbar\nquux";

    for diff in diff::lines(left, right) {
        match diff {
            diff::Result::Left(l)    => println!("-{}", l),
            diff::Result::Both(l, _) => println!(" {}", l),
            diff::Result::Right(r)   => println!("+{}", r)
        }
    }
}

prints

 foo
-bar
 baz
+bar
 quux

License

diff is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE, and LICENSE-MIT for details.

No runtime deps