pub fn decompress(r: &mut dyn Read, max_size: u32) -> Result<Vec<u8>, Error>Expand description
Decompress data read from r.
§Example
let data = [
0x47, 0x17, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x80, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x09,
];
let mut r = std::io::Cursor::new(data.as_ref());
let dec = quicklz::decompress(&mut r, 1024)?;
assert_eq!(&dec, &vec![0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);§Errors
If an error is returned, some bytes were already read from r, but some
of the data that belongs to the compressed part is maybe still in the
stream.
The decompressed size is limited to max_size. An error will be returned
if data would be larger.
If the incoming data are compressed using level 2, an error is returned.