https://crates.io/crates/match_cfg
From libc:
match_cfg! {
#[cfg(windows)] => {
mod windows;
pub use windows::*;
}
#[cfg(target_os = "redox")] => {
mod redox;
pub use redox::*;
}
#[cfg(all(target_env = "sgx", target_vendor = "fortanix"))] => {
mod sgx;
pub use sgx::*;
// ...
_ => {
// non-supported targets: empty...
}
From stdsimd:
#[cfg(any(
target_arch = "aarch64",
target_feature = "v7",
target_feature = "mclass"
))]
mod common;
match_cfg! {
#[cfg(any(
target_arch = "aarch64",
target_feature = "v7",
target_feature = "mclass"
))] => {
mod common;
pub use self::common::*;
}
_ => {
mod cp15;
pub use self::cp15::*;
}
}