compcol 0.4.0

A no_std collection of compression algorithms behind a uniform streaming trait, gated per-algorithm by Cargo features.
Documentation
[package]
name          = "compcol"
version       = "0.4.0"
edition       = "2024"
# Edition 2024 stabilised in Rust 1.85. Code uses `let chains` (Rust 1.88)
# inside the brotli encoder and the io adapters, so 1.88 is the real floor.
rust-version  = "1.88"
description   = "A no_std collection of compression algorithms behind a uniform streaming trait, gated per-algorithm by Cargo features."
license       = "MIT"
repository    = "https://github.com/magicaltux/compcol"
documentation = "https://docs.rs/compcol"
readme        = "README.md"
keywords      = ["compression", "no_std", "embedded"]
categories    = ["compression", "no-std"]

# Tell docs.rs to build the doc set with every feature on. Without this
# the rendered docs only show the default-feature surface (rle/deflate/
# zlib/gzip/factory) — two thirds of the crate's public API would be
# invisible to anyone reading docs.rs.
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[features]
default = ["alloc", "rle", "deflate", "zlib", "gzip", "factory"]
# Convenience meta-feature: every algorithm compiled in. Equivalent to
# `cargo build --all-features` at the CLI level; useful in downstream
# Cargo.toml entries (`features = ["all"]`) instead of a 20-item list.
all = [
    "alloc", "std", "tokio", "factory",
    "rle", "deflate", "zlib", "gzip",
    "lzma", "xz",
    "zstd", "brotli", "lz4", "snappy", "lzw",
    "lzo", "lzx", "quantum", "lzfse", "adc",
    "rar1", "rar2", "rar3", "rar5",
]
# Enables `alloc`-backed conveniences (e.g. the `factory` module, the
# `compcol::vec` one-shot helpers). Pulled in automatically by features
# that require heap allocation.
alloc   = []
# Enables the `compcol::io` adapters that wrap `std::io::{Read, Write}`
# around any `Encoder`/`Decoder`, plus `From<Error> for std::io::Error`
# and `impl std::error::Error for Error`. Pulls in `alloc`.
std     = ["alloc"]
# Runtime by-name lookup that returns boxed trait objects. Requires `alloc`.
factory = ["alloc"]
# Run-length encoding.
rle     = []
# RFC 1951 raw deflate. Requires `alloc` for the 32 KiB sliding window and
# the per-block symbol/bit buffers.
deflate = ["alloc"]
# RFC 1950 zlib (deflate + Adler-32 + 2-byte header / 4-byte trailer).
zlib    = ["deflate"]
# RFC 1952 gzip (deflate + CRC-32 + 10-byte header / 8-byte trailer).
gzip    = ["deflate"]
# LZMA (Lempel–Ziv–Markov chain). Range-coded, depends on alloc for the
# probability tables and the LZ window.
lzma    = ["alloc"]
# xz container (RFC-style stream/block headers + check codes; the inner
# LZMA2 chunk codec is inlined inside `src/xz/`).
xz      = ["lzma"]
# Zstandard (RFC 8478).
zstd    = ["alloc"]
# Brotli (RFC 7932). Carries a 170 KiB built-in static dictionary when fully
# implemented; expect a fat .rlib once it is.
brotli  = ["alloc"]
# LZ4 block format.
lz4     = ["alloc"]
# Google Snappy.
snappy  = ["alloc"]
# Lempel–Ziv–Welch (Unix compress / GIF).
lzw     = ["alloc"]
# LZO (Lempel–Ziv–Oberhumer), LZO1X-1 variant.
lzo     = ["alloc"]
# LZX (Microsoft CAB / WIM compression).
lzx     = ["alloc"]
# Quantum (Stac, old CAB format). Decoder-only target.
quantum = ["alloc"]
# LZFSE (Apple's LZ77 + Finite State Entropy). Decoder-only target — the
# encoder permanently returns `Error::Unsupported`. Handles `bvx-` and
# `bvxn` (LZVN) blocks; `bvx2` blocks return Unsupported in this build.
lzfse   = ["alloc"]
# ADC (Apple Data Compression) — the LZSS-like codec used in Apple DMG
# disk images and HFS+ compressed resource forks.
adc     = ["alloc"]
# RAR decoders (rar1, rar2, rar3, rar5). Decoder-only — RARLAB's unRAR
# license explicitly forbids re-creating the compression algorithm, so
# the encoders permanently return `Error::Unsupported`.
rar1    = ["alloc"]
rar2    = ["alloc"]
rar3    = ["alloc"]
rar5    = ["alloc"]
# `compcol::tokio_io` — async mirrors of compcol::io for the tokio
# runtime. Pulls the tokio dependency for its AsyncRead/AsyncWrite
# trait definitions; the rest of the crate stays dep-free.
tokio   = ["std", "dep:tokio"]

[lints.rust]
unsafe_code = "forbid"

[dependencies]
# Optional, pulled in only by the `tokio` feature. We need the AsyncRead/
# AsyncWrite traits, which live under the default-off `io-util` feature
# in tokio's modular layout.
tokio = { version = "1", default-features = false, optional = true }

[dev-dependencies]
# Test-only: the async tests need a runtime + the AsyncReadExt /
# AsyncWriteExt convenience methods that the library itself doesn't
# use. Production consumers can pick their own tokio feature set.
tokio = { version = "1", default-features = false, features = ["rt", "macros", "io-util"] }

[[bin]]
name             = "compcol"
path             = "src/bin/compcol.rs"
required-features = ["factory"]

[[example]]
name             = "bench"
path             = "examples/bench.rs"
required-features = ["factory"]