summaryrefslogtreecommitdiffstats
path: root/vendor/diff/examples/simple.rs
blob: 07cbc2056912f288b2110ee2958073d89a14b730 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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),
        }
    }
}