[][src]Crate libdeflater

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

CompressionLvl

Compression level used by a Compressor instance.

CompressionLvlIter

An iterator over the CompressionLvls supported by the Compressor.

Compressor

A libdeflate compressor that can compress arbitrary data into DEFLATE, zlib, or gzip formats.

Crc

Struct holding the state required to compute a rolling crc32 value.

Decompressor

A libdeflate decompressor that can inflate DEFLATE, zlib, or gzip data.

Enums

CompressionError

An error that may be returned when calling one of the Compressor's compress_* methods.

CompressionLvlError

Errors that can be returned when attempting to create a CompressionLvl from a numeric value.

DecompressionError

An error that may be returned by one of the Decompressor's decompress_* methods when a decompression cannot be performed.

Functions

crc32

Returns the CRC32 checksum of the bytes in data.