Crate libdeflater

source ·
Expand description

Rust bindings to libdeflate, a DEFLATE-based buffer compression/decompression library that works with raw DEFLATE, zlib, and gzip data.

Warning: Libdeflate is targeted at specialized performance-sensitive use-cases where developers have a good understanding of their input/output data. Developers looking for a general-purpose DEFLATE library should use something like flate2, which can handle a much wider range of inputs (network streams, large files, etc.).

§Decompression

Decompressor::new can be used to construct a Decompressor, which can decompress:

Note: libdeflate requires that the input and output buffers are pre-allocated before decompressing. Because of this, you will at least need to know the upper bound on how large the compressed data will decompress to; otherwise, a decompress_* function call will return DecompressionError::InsufficientSpace

§Compression

Compressor::new can be used to construct a Compressor, which can compress data into the following formats:

Because buffers must be allocated up-front, developers need to supply these functions with output buffers that are big enough to fit the compressed data. The maximum size of the compressed data can be found with the associated *_bound methods:

Structs§

Enums§

Functions§

  • Returns the Adler32 checksum of the bytes in data.
  • Returns the CRC32 checksum of the bytes in data.