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#[doc(hidden)]
46pub mod workspace;
47
48pub(crate) mod blocks;
49
50#[cfg(feature = "fuzz_exports")]
51pub mod fse;
52#[cfg(feature = "fuzz_exports")]
53pub mod huff0;
54
55#[cfg(not(feature = "fuzz_exports"))]
56pub(crate) mod fse;
57#[cfg(not(feature = "fuzz_exports"))]
58pub(crate) mod huff0;
59
60#[cfg(feature = "std")]
61pub mod io_std;
62
63#[cfg(feature = "std")]
64pub use io_std as io;
65
66#[cfg(not(feature = "std"))]
67pub mod io_nostd;
68
69#[cfg(not(feature = "std"))]
70pub use io_nostd as io;
71
72mod tests;