[−][src]Function xdelta3::decode
pub fn decode(input: &[u8], src: &[u8]) -> Option<Vec<u8>>
Function to decode the difference data
This function is used to decode the difference data.
The data in src
will be treated as "original" data and the
data in input
will be treated as "difference" or "patch" data.
The returned Vec
stores the data that has been patched
As opposed to the encode function, if you are building an application that applies patches or differential updates, this function should be used to patch or update the old file from the patch data. It's recommeded to check for the file integrity after doing the decode to prevent from creating potentially corrupted files
Here is a basic example to show how to use this function:
extern crate xdelta3; use xdelta3::decode; fn main() { let result = decode(&[214, 195, 196, 0, 0, 0, 13, 7, 0, 7, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8], &[1, 2, 4, 4, 7, 6, 7]); assert_eq!(result.unwrap().as_slice(), &[1, 2, 3, 4, 5, 6, 7]); }