Crate rdiff [] [src]

Finds the difference between sequential versions of files.

Based on the rsync algorithm. The BlockHashes struct will find the differences between versions of the same file. It does this through the diff_and_update() method.


use std::io::Cursor;
use rdiff::BlockHashes;

let mut hash = BlockHashes::new(Cursor::new("The initial version"), 8).unwrap();
let diffs = hash.diff_and_update(Cursor::new("The next version")).unwrap();
println!("Diffs: {:?}", diffs);
// Outputs "Diffs: Diff{inserts: [Insert(0, The next vers)], deletes:[Delete(13, 16)]}"

This crate also contains methods relating to finding the differences between two strings, in the string_diff module. These methods can be used to refine the course differences found through the rsync method.



Used for finding the minimal set of operations to transform one string into another.



Used for calculating and re-calculating the differences between two versions of the same file


Represents an operation to delete a certain number of bytes at a particular position in a file


Represents a series of operations that were performed on a file to transform it into a new version.


Represents an operation to insert bytes at a particular position into a file