]> git.proxmox.com Git - rustc.git/blame - vendor/diff/README.md
New upstream version 1.64.0+dfsg1
[rustc.git] / vendor / diff / README.md
CommitLineData
7cac9316
XL
1# diff.rs
2
3> An LCS based slice and string diffing implementation.
4
064997fb
FG
5## Install
6
7```toml
8[dependencies]
9diff = "0.1"
10```
11
7cac9316
XL
12## Example
13
14```rust
15extern crate diff;
16
17fn main() {
18 let left = "foo\nbar\nbaz\nquux";
19 let right = "foo\nbaz\nbar\nquux";
20
21 for diff in diff::lines(left, right) {
22 match diff {
23 diff::Result::Left(l) => println!("-{}", l),
24 diff::Result::Both(l, _) => println!(" {}", l),
25 diff::Result::Right(r) => println!("+{}", r)
26 }
27 }
28}
29```
30
31prints
32
33```
34 foo
35-bar
36 baz
37+bar
38 quux
39```
40
41## License
42
43`diff` is primarily distributed under the terms of both the MIT license and the
44Apache License (Version 2.0).
45
46See LICENSE-APACHE, and LICENSE-MIT for details.