1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![no_std]
//! Low-level bindings to the [zstd] library.
//!
//! [zstd]: https://facebook.github.io/zstd/

#[cfg(feature = "std")]
extern crate std;

#[cfg(target_arch = "wasm32")]
mod wasm_shim;

// If running bindgen, we'll end up with the correct bindings anyway.
#[cfg(feature = "bindgen")]
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));

// The bindings used depend on a few feature flags.

// No-std (libc-based)
#[cfg(all(
    not(feature = "std"),
    not(feature = "experimental"),
    not(feature = "bindgen")
))]
include!("bindings_zstd.rs");

#[cfg(all(
    not(feature = "std"),
    not(feature = "experimental"),
    feature = "zdict_builder",
    not(feature = "bindgen")
))]
include!("bindings_zdict.rs");

#[cfg(all(
    not(feature = "std"),
    feature = "experimental",
    not(feature = "bindgen")
))]
include!("bindings_zstd_experimental.rs");

#[cfg(all(
    not(feature = "std"),
    feature = "experimental",
    feature = "zdict_builder",
    not(feature = "bindgen")
))]
include!("bindings_zdict_experimental.rs");

// Std-based (no libc)
#[cfg(all(
    feature = "std",
    not(feature = "experimental"),
    not(feature = "bindgen")
))]
include!("bindings_zstd_std.rs");

// Std-based (no libc)
#[cfg(all(
    feature = "std",
    not(feature = "experimental"),
    feature = "zdict_builder",
    not(feature = "bindgen")
))]
include!("bindings_zdict_std.rs");

#[cfg(all(
    feature = "std",
    feature = "experimental",
    not(feature = "bindgen")
))]
include!("bindings_zstd_std_experimental.rs");

#[cfg(all(
    feature = "std",
    feature = "experimental",
    feature = "zdict_builder",
    not(feature = "bindgen")
))]
include!("bindings_zdict_std_experimental.rs");