Skip to main content

Crate git_pack_delta

Crate git_pack_delta 

Source
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§

DeltaIndex

Enums§

DiffDecodeError

Functions§

create_delta
Creates a delta encoding that can be used to create target from base.
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, returns None instead. This is ~10-20% faster than actually writing the delta and requires no memory allocations.
patch_delta
Recreates the target from the base and encoded delta.
write_delta_to
write_delta_to_vec