pub fn apply(base: &[u8], delta: &Patch) -> Result<Vec<u8>, Error>
Expand description
Applies a patch to transform the base data.
Takes a patch generated by diff()
and applies it to the base data
to recreate the target data.
ยงExample
use files_diff::{diff, apply, DEFAULT_ALGO};
let base = b"original data";
let target = b"modified data";
let (diff_algo, compress_algo) = DEFAULT_ALGO;
let patch = diff(base, target, diff_algo, compress_algo)?;
let result = apply(base, &patch)?;
assert_eq!(result, target);