Skip to main content

zrip_core/
lib.rs

1#![cfg_attr(not(feature = "std"), no_std)]
2#![cfg_attr(feature = "nightly", feature(optimize_attribute))]
3#![cfg_attr(feature = "paranoid", forbid(unsafe_code))]
4
5#[cfg(feature = "alloc")]
6extern crate alloc;
7
8pub mod error;
9pub mod hint;
10
11pub mod bitstream;
12pub mod fse;
13pub mod hash;
14pub mod huffman;
15pub mod xxhash;
16
17pub mod block;
18pub mod frame;
19
20pub mod simd;
21
22pub mod sequence;
23pub use sequence::Sequence;
24
25#[cfg(feature = "alloc")]
26pub mod dict;
27
28pub use error::{CompressError, DecompressError, ZstdError};
29
30pub const DEFAULT_DECOMPRESS_LIMIT: usize = usize::MAX;
31
32/// A conservative output limit (128 MiB) suitable for decompressing untrusted input.
33///
34/// Use this with [`decompress_with_limit`](crate) or [`DecompressContext::decompress_with_limit`]
35/// when processing data from untrusted sources to bound memory usage.
36pub const SAFE_DECOMPRESS_LIMIT: usize = 128 * 1024 * 1024;
37
38#[doc(hidden)]
39pub const LARGE_OUTPUT_THRESHOLD: usize = 512 * 1024;