Function compress_bound

pub const fn compress_bound(source_len: usize) -> usize

Returns the upper bound on the compressed size for an input of source_len bytes.

When compression has this much space available, it will never fail because of insufficient output space.

Example

# use zlib_rs::*;

assert_eq!(compress_bound(1024), 1161);
assert_eq!(compress_bound(4096), 4617);
assert_eq!(compress_bound(65536), 73737);

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