Skip to main content

Crate async_compression

Crate async_compression 

Source
Expand description

Adaptors between compression crates and Rust’s modern asynchronous IO types.

§Feature Organization

This crate is divided up along two axes, which can each be individually selected via Cargo features.

All features are disabled by default, you should enable just the ones you need from the lists below.

If you want to pull in everything there are three group features defined:

FeatureDoes
allActivates all implementations and algorithms.
all-implementationsActivates all implementations, needs to be paired with a selection of algorithms
all-algorithmsActivates all algorithms, needs to be paired with a selection of implementations

§IO implementation

The first division is which underlying asynchronous IO trait will be wrapped, these are available as separate features that have corresponding top-level modules:

FeatureType
futures-io (inactive)futures::io::AsyncBufRead, futures::io::AsyncWrite
tokiotokio::io::AsyncBufRead, tokio::io::AsyncWrite

§Compression algorithm

The second division is which compression schemes to support, there are currently a few available choices, these determine which types will be available inside the above modules:

FeatureTypes
brotliBrotliEncoder, BrotliDecoder
brotli-mbrotli (unstable, inactive)MbrotliEncoder, MbrotliDecoder
bzip2 (inactive)BzEncoder, BzDecoder
deflate (inactive)DeflateEncoder, DeflateDecoder
gzipGzipEncoder, GzipDecoder
lz4 (inactive)Lz4Encoder, Lz4Decoder
lzma (inactive)LzmaEncoder, LzmaDecoder
xz (inactive)XzEncoder, XzDecoder
zlibZlibEncoder, ZlibDecoder
zstdZstdEncoder, ZstdDecoder
zstd-mzstd (unstable, inactive)MzstdEncoder, MzstdDecoder
deflate64 (inactive)(encoder not implemented), Deflate64Decoder

§Unstable features

Some features are not yet covered by this crate’s stability guarantees. They only take effect when the crate is also built with --cfg async_compression_unstable, for example through RUSTFLAGS="--cfg async_compression_unstable", and they may change or be removed in any release:

  • brotli-mbrotli adds MbrotliEncoder and MbrotliDecoder, a Brotli implementation backed by the pure-Rust mbrotli crate. It is an alternative to the brotli feature and produces the same format. mbrotli requires Rust 1.89 or newer.
  • zstd-mzstd adds MzstdEncoder and MzstdDecoder, a Zstandard implementation backed by the pure-Rust mzstd crate. It is an alternative to the zstd feature and produces the same format. mzstd requires Rust 1.89 or newer.

§Multi-thread support

The xz compression algorithm supports multi-threaded compression and decompression. Enable the xz-parallel feature to enable multi-threading support.

Re-exports§

pub use compression_codecs as codecs;
pub use compression_core as core;

Modules§

brotli
This module contains Brotli-specific types for async-compression.
generic 🔒
Generic, async runtime agonistc implementation of en/decoders
macros 🔒
tokio
Implementations for IO traits exported by tokio v1.x.
zstd
This module contains zstd-specific types for async-compression.

Enums§

Level
Level of compression data should be compressed with.