compress

Function compress 

Source
pub fn compress(
    input: &[u8],
    format: CompressionFormat,
    level: CompressionLevel,
) -> Result<Vec<u8>, String>
Expand description

Compresses a byte slice using the specified format and compression level.

§Parameters

  • input: The byte slice to be compressed.
  • format: The compression format to use (Gzip, Deflate, or Zlib).
  • level: The compression level to apply (Fastest, Default, or Best).

§Returns

A Result containing the compressed data as a Vec<u8> on success, or a String with an error message on failure.