4 releases
0.1.6 | Aug 8, 2021 |
---|---|
0.1.5 | Jul 31, 2021 |
0.1.3 | Jun 24, 2017 |
#184 in Compression
86 downloads per month
Used in cargo-mextk
17KB
338 lines
bsdiff-rs
Rust port of a bsdiff library. High performance patching. All written in safe Rust.
lib.rs
:
Bsdiff is a method of diffing files. This crate has been ported from C code. The original code and more info can be found here.
It is usually a good idea to use bsdiff alongside a compression algorithm like bzip2.
Examples
use std::io::Cursor;
# use bsdiff::{patch, diff};
let one = vec![1, 2, 3, 4, 5];
let two = vec![1, 2, 4, 6];
let mut cursor = Cursor::new(Vec::new());
diff::diff(&one, &two, &mut cursor).unwrap();
cursor.set_position(0);
let mut patched = vec![0; two.len()];
patch::patch(&one, &mut cursor, &mut patched).unwrap();
assert_eq!(patched, two);