Expand description
A faster fork of the Zopfli compression library.
Zopfli is a DEFLATE compressor that produces near-optimal output at the cost of speed. zenzop produces identical output to zopfli but runs 1.2–2x faster through algorithmic improvements: precomputed cost tables, SIMD-accelerated match comparison, and a skip-hash optimization that eliminates redundant hash chain walks on cached iterations.
With Options::enhanced enabled, zenzop applies ECT-derived optimizations — expanded
precode search, multi-strategy Huffman tree selection, and enhanced parser diversification —
to produce smaller output than standard Zopfli.
§Features
This crate exposes the following features. You can enable or disable them in your Cargo.toml
as needed.
gzip(enabled by default): enables support for compression in the gzip format.zlib(enabled by default): enables support for compression in the Zlib format.std(enabled by default): enables linking against the Rust standard library. When not enabled, the crate is built with the#![no_std]attribute and can be used in any environment wherealloc(i.e., a memory allocator) is available. In addition, the crate exposes minimalist versions of thestdI/O traits it needs to function, allowing users to implement them.
Structs§
- Compress
Result - The result of a compression operation.
- Deflate
Encoder - A DEFLATE encoder powered by the Zopfli algorithm that compresses data written
to it to the specified sink. Most users will find using
compresseasier and more performant. - Error
- The error type for I/O operations of the
Writetrait. - Gzip
Encoder - A Gzip encoder powered by the Zopfli algorithm, that compresses data using
a
DeflateEncoder. Most users will find usingcompresseasier and more performant. - Options
- Options for the Zopfli compression algorithm.
- Unstoppable
- A
Stopimplementation that never stops (no cooperative cancellation). - Zlib
Encoder - A Zlib encoder powered by the Zopfli algorithm, that compresses data using
a
DeflateEncoder. Most users will find usingcompresseasier and more performant.
Enums§
- Block
Type - The type of data blocks to generate for a DEFLATE stream.
- Error
Kind - A list specifying general categories of I/O error.
- Format
- The output file format to use to store data compressed with Zopfli.
- Stop
Reason - Why an operation was stopped.
Traits§
- Stop
- Cooperative cancellation check.
- Write
- A trait for objects which are byte-oriented sinks, modeled after its
std::io::Writecounterpart.
Functions§
- compress
- Compresses data from a source with the Zopfli algorithm, using the specified options, and writes the result to a sink in the defined output format.