Expand description
Creates a delta encoding that can be used to create target from base.
let base = "This is a pure rust implementation of Git's delta compression algorithm.";
let target = base.replace("Git", "git");
let delta = git_pack_delta::create_delta(base.as_bytes(), target.as_bytes()).unwrap();
assert_eq!(delta.len(), 9);
let target2 = git_pack_delta::patch_delta(base.as_bytes(), &delta).unwrap();
assert_eq!(target.as_bytes(), target2);See: https://github.com/git/git/blob/master/diff-delta.c and https://github.com/git/git/blob/master/patch-delta.c
Re-exports§
pub use hash::RollingHash;
Modules§
- hash
- match_
bytes - SIMD accelerated utilities for counting the number of matching bytes from the start of two slices.
- varint
- Utilities for LEB128 (Little Endian Base 128) encoding and decoding of integers.
Structs§
Enums§
Traits§
- Delta
Writer - A writer for delta instructions
Functions§
- create_
delta - Creates a delta encoding that can be used to create
targetfrombase. - create_
delta_ index - Creates a reusable hash index from a base buffer.
- create_
delta_ index_ custom - Creates a delta hash index from a base buffer using a specified hash algorithm.
- create_
delta_ index_ custom_ stride - Creates a delta hash index from a base buffer using a specified hash algorithm and
stride. - get_
delta_ len - Returns the length of the delta encoding for the given base and target using the specified index.
- patch_
delta - Recreates the target from the
baseand encodeddelta. - write_
delta_ to - Writes delta encoding that can re-create
targetfrombaseinto aDeltaWriter(e.g.,Vec<u8>). - write_
delta_ to_ vec - Writes delta encoding that can re-create
targetfrombaseinto aVec<u8>.