z_rs/
lib.rs

1#![cfg_attr(feature = "gzprintf", feature(c_variadic))]
2extern crate libz_rs_sys;
3
4pub use libz_rs_sys::*;
5
6#[cfg(not(any(panic = "abort", feature = "__internal-test", test, doc, miri)))]
7compile_error!("panic=\"abort\" is mandatory because unwinding to C is undefined behavior");
8
9#[cfg(feature = "gz")]
10mod gz;
11
12#[cfg(feature = "gz")]
13pub use gz::*;
14
15#[cfg(feature = "gz")]
16#[allow(unused)]
17mod custom_prefix {
18    #[cfg(feature = "custom-prefix")]
19    macro_rules! prefix {
20        ($name:expr) => {
21            concat!(env!("LIBZ_RS_SYS_PREFIX"), stringify!($name))
22        };
23    }
24
25    // NOTE: once we reach 1.0.0, the macro used for the `semver-prefix` feature should no longer include the
26    // minor version in the name. The name is meant to be unique between semver-compatible versions!
27    const _PRE_ONE_DOT_O: () = assert!(env!("CARGO_PKG_VERSION_MAJOR").as_bytes()[0] == b'0');
28
29    #[cfg(feature = "semver-prefix")]
30    macro_rules! prefix {
31        ($name:expr) => {
32            concat!(
33                "LIBZ_RS_SYS_v",
34                env!("CARGO_PKG_VERSION_MAJOR"),
35                "_",
36                env!("CARGO_PKG_VERSION_MINOR"),
37                "_x_",
38                stringify!($name)
39            )
40        };
41    }
42
43    #[cfg(all(not(feature = "custom-prefix"), not(feature = "semver-prefix"),))]
44    macro_rules! prefix {
45        ($name:expr) => {
46            stringify!($name)
47        };
48    }
49
50    #[cfg(all(not(feature = "custom-prefix"), not(feature = "semver-prefix"), test))]
51    macro_rules! prefix {
52        ($name:expr) => {
53            concat!("LIBZ_RS_SYS_TEST_", stringify!($name))
54        };
55    }
56
57    pub(crate) use prefix;
58}
59
60#[cfg(feature = "gz")]
61pub(crate) use custom_prefix::prefix;