Function compress_slice

pub fn compress_slice<'a>(output: &'a mut [u8], input: &[u8], config: DeflateConfig) -> (&'a mut [u8], ReturnCode)

Compresses input into the provided output buffer.

Returns a subslice of output containing the compressed bytes and a ReturnCode indicating the result of the operation. Returns ReturnCode::BufError if there is insufficient output space.

Use compress_bound for an upper bound on how large the output buffer needs to be.

Example

# use zlib_rs::*;
# fn foo(input: &[u8]) {
let mut buf = vec![0u8; compress_bound(input.len())];
let (compressed, rc) = compress_slice(&mut buf, input, DeflateConfig::default());
# }