Skip to main content

zstd_complete/
lib.rs

1//! A pure Rust implementation of the [Zstandard compression format](https://www.rfc-editor.org/rfc/rfc8878.pdf).
2//!
3//! ## Decompression
4//! The [decoding] module contains the code for decompression.
5//! Decompression can be achieved by using the [`decoding::StreamingDecoder`]
6//! or the more low-level [`decoding::FrameDecoder`]
7//!
8//! ## Compression
9//! The [encoding] module contains the code for compression.
10//! Compression can be achieved by using the [`encoding::compress`]/[`encoding::compress_to_vec`]
11//! functions or [`encoding::FrameCompressor`]
12//!
13#![doc = include_str!("../Readme.md")]
14#![no_std]
15#![cfg_attr(docsrs, feature(doc_cfg))]
16#![deny(trivial_casts, trivial_numeric_casts, rust_2018_idioms)]
17
18#[cfg(feature = "std")]
19extern crate std;
20
21#[cfg(not(feature = "rustc-dep-of-std"))]
22extern crate alloc;
23
24#[cfg(feature = "std")]
25pub(crate) const VERBOSE: bool = false;
26
27macro_rules! vprintln {
28    ($($x:expr),*) => {
29        #[cfg(feature = "std")]
30        if crate::VERBOSE {
31            std::println!($($x),*);
32        }
33    }
34}
35
36mod bit_io;
37mod common;
38mod cpu;
39pub mod decoding;
40#[cfg(feature = "dict_builder")]
41#[cfg_attr(docsrs, doc(cfg(feature = "dict_builder")))]
42pub mod dictionary;
43pub mod encoding;
44mod kernel;
45
46pub(crate) mod blocks;
47
48#[cfg(feature = "fuzz_exports")]
49pub mod fse;
50#[cfg(feature = "fuzz_exports")]
51pub mod huff0;
52
53#[cfg(not(feature = "fuzz_exports"))]
54pub(crate) mod fse;
55#[cfg(not(feature = "fuzz_exports"))]
56pub(crate) mod huff0;
57
58#[cfg(feature = "std")]
59pub mod io_std;
60
61#[cfg(feature = "std")]
62pub use io_std as io;
63
64#[cfg(not(feature = "std"))]
65pub mod io_nostd;
66
67#[cfg(not(feature = "std"))]
68pub use io_nostd as io;
69
70mod tests;