[][src]Function lzzzz::lz4::decompress

pub fn decompress(src: &[u8], dst: &mut [u8]) -> Result<usize>

Decompresses a LZ4 block.

The length of the destination slice must be equal to the original data length.

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; ORIGINAL_SIZE];

lz4::decompress(&data[..], &mut buf[..])?;

assert_eq!(
    &buf[..],
    &b"The quick brown fox jumps over the lazy dog."[..]
);