Function lzzzz::lz4::decompress_partial
source · pub fn decompress_partial(
src: &[u8],
dst: &mut [u8],
original_size: usize
) -> Result<usize>
Expand description
Decompresses an LZ4 block until the destination slice fills up.
Returns the number of bytes written into the destination buffer.
§Example
use lzzzz::lz4;
const ORIGINAL_SIZE: usize = 44;
const COMPRESSED_DATA: &str =
"8B1UaGUgcXVpY2sgYnJvd24gZm94IGp1bXBzIG92ZXIgdGhlIGxhenkgZG9nLg==";
let data = base64::decode(COMPRESSED_DATA).unwrap();
let mut buf = [0u8; 24];
lz4::decompress_partial(&data[..], &mut buf[..], ORIGINAL_SIZE)?;
assert_eq!(&buf[..], &b"The quick brown fox jump"[..]);