pub mod target_arch;
pub use target_arch::cfg_target_arch_info;
pub mod target_feature;
pub use target_feature::cfg_target_feature_info;
pub mod target_os;
pub use target_os::cfg_target_os_info;
pub mod target_family;
pub use target_family::cfg_target_family_info;
pub mod target_env;
pub use target_env::cfg_target_env_info;
pub mod target_endian;
pub use target_endian::cfg_target_endian_info;
pub mod target_pointer_width;
pub use target_pointer_width::cfg_target_pointer_width_info;
pub mod target_has_atomic;
pub use target_has_atomic::cfg_target_has_atomic_info;
pub mod target_vendor;
pub use target_vendor::cfg_target_vendor_info;
pub mod panic;
pub use panic::cfg_panic_info;
pub const TARGET_ARCH: cfg_target_arch_info = target_arch::ALL_INFO;
pub const TARGET_FEATURE: cfg_target_feature_info = target_feature::ALL_INFO;
pub const TARGET_OS: cfg_target_os_info = target_os::ALL_INFO;
pub const TARGET_FAMILY: cfg_target_family_info = target_family::ALL_INFO;
pub const TARGET_ENV: cfg_target_env_info = target_env::ALL_INFO;
pub const TARGET_ENDIAN: cfg_target_endian_info = target_endian::ALL_INFO;
pub const TARGET_POINTER_WIDTH: cfg_target_pointer_width_info = target_pointer_width::ALL_INFO;
pub const TARGET_HAS_ATOMIC: cfg_target_has_atomic_info = target_has_atomic::ALL_INFO;
pub const TARGET_VENDOR: cfg_target_vendor_info = target_vendor::ALL_INFO;
pub const TEST: bool = cfg!(test);
pub const DEBUG_ASSERTIONS: bool = cfg!(debug_assertions);
pub const PROC_MACRO: bool = cfg!(proc_macro);
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
pub struct cfg_info {
pub target_arch: cfg_target_arch_info,
pub target_feature: cfg_target_feature_info,
pub target_os: cfg_target_os_info,
pub target_family: cfg_target_family_info,
pub target_env: cfg_target_env_info,
pub target_endian: cfg_target_endian_info,
pub target_pointer_width: cfg_target_pointer_width_info,
pub target_has_atomic: cfg_target_has_atomic_info,
pub target_vendor: cfg_target_vendor_info,
pub test: bool,
pub debug_assertions: bool,
pub proc_macro: bool,
}
pub const ALL_INFO: cfg_info = all_info();
pub const fn all_info() -> cfg_info {
cfg_info {
target_arch: TARGET_ARCH,
target_feature: TARGET_FEATURE,
target_os: TARGET_OS,
target_family: TARGET_FAMILY,
target_env: TARGET_ENV,
target_endian: TARGET_ENDIAN,
target_pointer_width: TARGET_POINTER_WIDTH,
target_has_atomic: TARGET_HAS_ATOMIC,
target_vendor: TARGET_VENDOR,
test: TEST,
debug_assertions: DEBUG_ASSERTIONS,
proc_macro: PROC_MACRO,
}
}
#[cfg(feature = "json")]
impl cfg_info {
pub fn to_json(&self) -> serde_json::Value {
serde_json::json!({
"target_arch": self.target_arch.to_json(),
"target_feature": self.target_feature.to_json(),
"target_os": self.target_os.to_json(),
"target_family": self.target_family.to_json(),
"target_env": self.target_env.to_json(),
"target_endian": self.target_endian.to_json(),
"target_pointer_width": self.target_pointer_width.to_json(),
"target_has_atomic": self.target_has_atomic.to_json(),
"target_vendor": self.target_vendor.to_json(),
"test": self.test,
"debug_assertions": self.debug_assertions,
"proc_macro": self.proc_macro,
})
}
}