#side #diff #text #side-by-side

side-by-side-diff

Create side-by-side diff text

3 releases

0.1.2 Feb 18, 2023
0.1.1 Feb 18, 2023
0.1.0 Feb 18, 2023

#21 in #side

MIT license

6KB
81 lines

side-by-side-diff

Latest Version Crates.io License

The side-by-side-diff crate is a wrapper of Similar. The side-by-side-diff creates side-by-side diff text from two texts.

use side_by_side_diff::create_side_by_side_diff;

fn main() {
    let diff = create_side_by_side_diff("aaa\niii\nuuu", "aaa\nii\nuuu", 20);
    println!("{diff}");
}
$ cargo run
     1 | aaa                  |      1 | aaa                  |
     2 | iii                  |        |                      |
       |                      |      2 | ii                   |
     3 | uuu                  |      3 | uuu                  |

Dependencies

~1.5MB
~22K SLoC