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