diffkit
A Rust library for diffing and patching sequences and nested structures.
Features
- Myers diff — efficient sequence diffing via the Myers algorithm
- Recursive diff — structural diffing of nested maps and sequences
- Hunks — group changes with context lines
- Unified diff — serialize and deserialize patches in unified diff format
Installation
Add to your Cargo.toml:
[]
= "0.1.0"
Usage
Sequence diff
use diff;
use ;
use ToPatch;
let old = vec!;
let new = vec!;
let myers_edits = diff;
Recursive diff
use HashMap;
use ;
use hunks;
let mut old = new;
old.insert;
let mut new = new;
new.insert;
let changes = diff;
let equal_to_new = apply;
Applying a patch
use diff;
use ;
use ToPatch;
let old = vec!;
let new = vec!;
let myers_edits = diff;
let hunks = hunks;
let patch = hunks.to_patch;
let equal_to_new = apply;
License
See UNLICENSE for details.