tree: 9f5f5d32f7d8c5261b8793ef898e9ab5a0604523 [path history] [tgz]
  1. benches/
  2. examples/
  3. src/
  4. tests/
  5. .cargo-checksum.json
  6. Cargo.lock
  7. Cargo.toml
  8. LICENSE-APACHE
  9. LICENSE-MIT
  10. OWNERS
  11. README.md
third_party/rust_crates/vendor/diff-0.1.13/README.md

diff.rs

An LCS based slice and string diffing implementation.

Install

[dependencies]
diff = "0.1"

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.