Function zstd_safe::compress

source ·
pub fn compress<C: WriteBuf + ?Sized>(
    dst: &mut C,
    src: &[u8],
    compression_level: CompressionLevel
) -> SafeResult
Expand description

Wraps the ZSTD_compress function.

This will try to compress src entirely and write the result to dst, returning the number of bytes written. If dst is too small to hold the compressed content, an error will be returned.

For streaming operations that don’t require to store the entire input/ouput in memory, see compress_stream.