Skip to main content

zstd_sys/
lib.rs

1#![allow(non_upper_case_globals)]
2#![allow(non_camel_case_types)]
3#![allow(non_snake_case)]
4#![no_std]
5//! Low-level bindings to the [zstd] library.
6//!
7//! [zstd]: https://facebook.github.io/zstd/
8
9#[cfg(target_family = "wasm")]
10extern crate alloc;
11
12// Linked for the `ZSTD_*` symbols it exports, which our bindings call.
13#[cfg(feature = "rust-backend")]
14extern crate libzstd_rs_sys;
15
16// Otherwise the seekable functions would only fail at link time.
17#[cfg(all(feature = "rust-backend", feature = "seekable"))]
18compile_error!(
19    "the `seekable` feature is not supported with `rust-backend`: \
20     libzstd-rs-sys does not include zstd's seekable format"
21);
22
23#[cfg(target_family = "wasm")]
24mod wasm_shim;
25
26// If running bindgen, we'll end up with the correct bindings anyway.
27#[cfg(feature = "bindgen")]
28include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
29
30// The bindings used depend on a few feature flags.
31#[cfg(all(not(feature = "experimental"), not(feature = "bindgen")))]
32include!("bindings_zstd.rs");
33
34#[cfg(all(
35    not(feature = "experimental"),
36    feature = "zdict_builder",
37    not(feature = "bindgen")
38))]
39include!("bindings_zdict.rs");
40
41#[cfg(all(feature = "experimental", not(feature = "bindgen")))]
42include!("bindings_zstd_experimental.rs");
43
44#[cfg(all(
45    feature = "experimental",
46    feature = "zdict_builder",
47    not(feature = "bindgen")
48))]
49include!("bindings_zdict_experimental.rs");
50
51#[cfg(all(feature = "seekable", not(feature = "bindgen")))]
52include!("bindings_zstd_seekable.rs");