Crate zx0

source · []
Expand description

A ZX0 compressor implementation for Rust.

This crate provides a Rust implementation for Einar Saukas’ excellent ZX0 compression algorithm.

The algorithm provided in this crate is a more optimized variant of the original C-based implementation, and is therefore about 40% faster compared to the original. Additionally, the Rust implementation also offers thread-safety, meaning that files can now be compressed in parallel. Finally, this implementation is also free of memory leaks.

To guarantee correctness the crate offers a sub-crate containing a Rust wrapper of the original C code. This wrapper is used as a reference in the crate’s test suite to ensure that its output is 100% equivalent to the original implementation.

The compressor can be used in two ways:

  1. By instantiating a Compressor instance, configuring it, and invoking its compress method.

  2. Using the top level compress shortcut function to compress with the default settings.

Please refer to the documentation for the Compressor struct for more information on how to use this crate, or inspect the examples that are provided in the crate’s source code.

Additionally, there is a wealth of information provided in the readme file of Einar Saukas’ original implementation.

Structs

A struct containing a vector representing the compressed data, as well as metadata related to the compression operation.

This struct provides a means of initializing and performing a ZX0 compression operation by leveraging the builder pattern.

Functions

Compress the input slice to an output vector.