libxdiff

Safe, idiomatic Rust bindings for the libxdiff C library.

Crates.io docs

Usage

Add this to your Cargo.toml:

toml [dependencies] libxdiff = "0.2"

Example

```rust use core::str::from_utf8; use libxdiff::MMFile;

let mut f1 = MMFile::frombytes(b"hello world\n"); let mut f2 = MMFile::frombytes(b"hello world!\n"); let mut difflines = Vec::::new(); f1.diffraw(&mut f2, |line: &[u8]| { difflines.push(fromutf8(line).unwrap().toowned()); }) .unwrap(); asserteq!( diff_lines, vec![ "@@ -1,1 +1,1 @@\n", "-", "hello world\n", "+", "hello world!\n", ], ); ```

Linkage

Upstream libxdiff is small and has no dependencies, so this crate links it statically.