Skip to main content

compress

Function compress 

Source
pub fn compress(
    ct: CompressionType,
    data: &[u8],
) -> Result<Bytes, CompressionError>
Expand description

Compress data using the codec identified by ct.

For CompressionType::None, the function returns the input unchanged in a new Bytes. For the other codecs, it dispatches to the per-codec module. If the codec’s Cargo feature is not enabled, it returns Err(CompressionError::FeatureDisabled(_)).

§Errors

Returns an error when input is malformed, compression or decompression fails, or runtime rate-limit state cannot be updated.