ruzstd/
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#![deny(trivial_casts, trivial_numeric_casts, rust_2018_idioms)]
16
17#[cfg(feature = "std")]
18extern crate std;
19
20#[cfg(not(feature = "rustc-dep-of-std"))]
21extern crate alloc;
22
23#[cfg(feature = "std")]
24pub(crate) const VERBOSE: bool = false;
25
26macro_rules! vprintln {
27    ($($x:expr),*) => {
28        #[cfg(feature = "std")]
29        if crate::VERBOSE {
30            std::println!($($x),*);
31        }
32    }
33}
34
35mod bit_io;
36mod common;
37pub mod decoding;
38#[cfg(feature = "dict_builder")]
39#[cfg_attr(docsrs, doc(cfg(feature = "dict_builder")))]
40pub mod dictionary;
41pub mod encoding;
42
43pub(crate) mod blocks;
44
45#[cfg(feature = "fuzz_exports")]
46pub mod fse;
47#[cfg(feature = "fuzz_exports")]
48pub mod huff0;
49
50#[cfg(not(feature = "fuzz_exports"))]
51pub(crate) mod fse;
52#[cfg(not(feature = "fuzz_exports"))]
53pub(crate) mod huff0;
54
55#[cfg(feature = "std")]
56pub mod io_std;
57
58#[cfg(feature = "std")]
59pub use io_std as io;
60
61#[cfg(not(feature = "std"))]
62pub mod io_nostd;
63
64#[cfg(not(feature = "std"))]
65pub use io_nostd as io;
66
67mod tests;