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§
Functions§
- create_
delta - Creates a delta encoding that can be used to create
targetfrombase. - create_
delta_ index - create_
delta_ index_ custom - get_
delta_ len - Returns the length of the delta encoding for the given base and target using the specified index.
If the length of the delta would exceed
max_output_len, returnsNoneinstead. This is ~10-20% faster than actually writing the delta and requires no memory allocations. - patch_
delta - Recreates the target from the
baseand encodeddelta. - write_
delta_ to - write_
delta_ to_ vec