compress_slice

Function compress_slice 

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

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

let mut buf = vec![0u8; compress_bound(input.len())];
let (compressed, rc) = compress_slice(&mut buf, input, DeflateConfig::default());