pub fn decompress(
ct: CompressionType,
data: &[u8],
max_output: ByteSize,
) -> Result<Bytes, CompressionError>Expand description
Decompress data using the codec identified by ct. See compress.
max_output bounds the size of the decompressed output. If decompression
would produce more than max_output bytes, the function returns
Err(CompressionError::TooLarge { .. }) and does not materialize the
oversized buffer. This guards against decompression bombs on the untrusted
decode path. Callers that handle wire input should derive max_output from
the compressed length, for example from a bounded ratio plus an absolute
ceiling.
ยงErrors
Returns an error when input is malformed, compression or decompression fails, or runtime rate-limit state cannot be updated.