Skip to main content

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