1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
[]
= "compcol"
= "0.4.6"
= "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.
= "1.88"
= "A no_std collection of compression algorithms behind a uniform streaming trait, gated per-algorithm by Cargo features."
= "MIT"
= "https://github.com/KarpelesLab/compcol"
= "https://docs.rs/compcol"
= "README.md"
= ["compression", "no_std", "embedded"]
= ["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.
[]
= true
= ["--cfg", "docsrs"]
[]
= ["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.
= [
"alloc", "std", "tokio", "factory",
"rle", "deflate", "deflate64", "zlib", "gzip",
"lzma", "xz",
"zstd", "brotli", "lz4", "snappy", "lzw", "bzip2",
"lzo", "lzx", "amiga_lzx", "quantum", "lzfse", "adc",
"ppmd",
"xpress_huffman",
"lznt1",
"xpress",
"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.
= []
# 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`.
= ["alloc"]
# Runtime by-name lookup that returns boxed trait objects. Requires `alloc`.
= ["alloc"]
# Run-length encoding.
= []
# RFC 1951 raw deflate. Requires `alloc` for the 32 KiB sliding window and
# the per-block symbol/bit buffers.
= ["alloc"]
# PKWARE deflate64 (zip method 9). Same framing as deflate but a 64 KiB
# window and an extended length/distance alphabet. Standalone module —
# does not depend on the `deflate` feature.
= ["alloc"]
# RFC 1950 zlib (deflate + Adler-32 + 2-byte header / 4-byte trailer).
= ["deflate"]
# RFC 1952 gzip (deflate + CRC-32 + 10-byte header / 8-byte trailer).
= ["deflate"]
# LZMA (Lempel–Ziv–Markov chain). Range-coded, depends on alloc for the
# probability tables and the LZ window.
= ["alloc"]
# xz container (RFC-style stream/block headers + check codes; the inner
# LZMA2 chunk codec is inlined inside `src/xz/`).
= ["lzma"]
# Zstandard (RFC 8478).
= ["alloc"]
# Brotli (RFC 7932). Carries a 170 KiB built-in static dictionary when fully
# implemented; expect a fat .rlib once it is.
= ["alloc"]
# LZ4 block format.
= ["alloc"]
# Google Snappy.
= ["alloc"]
# Lempel–Ziv–Welch (Unix compress / GIF).
= ["alloc"]
# bzip2 (block-sorted: RLE-1 → BWT → MTF → RLE-2 → Huffman). Encoder
# and decoder both implemented; the encoder uses a naive O(n² log n)
# suffix-array build (rather than SA-IS) for the BWT.
= ["alloc"]
# LZO (Lempel–Ziv–Oberhumer), LZO1X-1 variant.
= ["alloc"]
# LZX (Microsoft CAB / WIM compression).
= ["alloc"]
# Amiga LZX (the original 1995 Forbes LZX as used in Amiga `.lzx` archives).
# Block-level identical to MS-CAB LZX (which is what `lzx` provides) but with
# a fixed 64 KiB window and no 32 KiB chunking or x86 E8-filter framing.
= ["alloc"]
# Quantum (Stac, old CAB format). Decoder-only target.
= ["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.
= ["alloc"]
# ADC (Apple Data Compression) — the LZSS-like codec used in Apple DMG
# disk images and HFS+ compressed resource forks.
= ["alloc"]
# PPMd (Dmitry Shkarin's PPMII variant H, used in 7z/RAR/ZIP method 98).
# Decoder-only target — the encoder permanently returns
# `Error::Unsupported` (the PPM model with information-inheritance updates
# is out of scope for this build).
= ["alloc"]
# XPress Huffman ([MS-XCA] §2.1): LZ77 + canonical Huffman used by WIM
# resources and NTFS CompactOS file compression. Encoder and decoder
# both implemented.
= ["alloc"]
# LZNT1 — NTFS native file compression. 4 KiB chunked LZ77, no entropy
# coding. Per Microsoft MS-XCA section 2.5.
= ["alloc"]
# Microsoft Xpress (Plain LZ77 variant from MS-XCA). Byte-aligned
# LZ77 with no entropy coding; encoder and decoder both implemented.
= ["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`.
= ["alloc"]
= ["alloc"]
= ["alloc"]
= ["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.
= ["std", "dep:tokio"]
[]
= "forbid"
[]
# 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.
= { = "1", = false, = true }
[]
# 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.
= { = "1", = false, = ["rt", "macros", "io-util"] }
[[]]
= "compcol"
= "src/bin/compcol.rs"
= ["factory"]
[[]]
= "bench"
= "examples/bench.rs"
= ["factory"]