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

Traits§

DeltaWriter
A writer for delta instructions

Functions§

create_delta
Creates a delta encoding that can be used to create target from base.
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 base and encoded delta.
write_delta_to
Writes delta encoding that can re-create target from base into a DeltaWriter (e.g., Vec<u8>).
write_delta_to_vec
Writes delta encoding that can re-create target from base into a Vec<u8>.