Function lzzzz::lz4_hc::compress_partial
source · [−]pub fn compress_partial<T>(
src: &mut Cursor<T>,
dst: &mut [u8],
level: i32
) -> Result<usize> where
T: AsRef<[u8]>,
Expand description
Compresses data until the destination slice fills up.
Returns the number of bytes written into the destination buffer.
Example
use lzzzz::{lz4, lz4_hc};
use std::io::Cursor;
let data = b"The quick brown fox jumps over the lazy dog.";
let mut buf = [0u8; 16];
let mut src = Cursor::new(&data[..]);
let len = lz4_hc::compress_partial(&mut src, &mut buf, lz4_hc::CLEVEL_DEFAULT)?;
let compressed = &buf[..len];