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
macro_rules! platforms {
($($($platform:expr);* => $module:ident),*) => {
$(
#[cfg(any(test, $(target_os = $platform),*))]
#[cfg_attr(not(any($(target_os = $platform),*)), allow(dead_code))]
mod $module;
#[cfg(any($(target_os = $platform),*))]
pub use self::$module::*;
#[cfg(any($(target_os = $platform),*))]
pub const ENOATTR: ::libc::c_int = ::libc::ENOATTR;
)*
#[cfg(any(test, all(feature = "unsupported", not(any($($(target_os = $platform),*),*)))))]
#[cfg_attr(any($($(target_os = $platform),*),*), allow(dead_code))]
mod unsupported;
#[cfg(all(feature = "unsupported", not(any($($(target_os = $platform),*),*))))]
pub use self::unsupported::*;
#[cfg(all(feature = "unsupported", not(any($($(target_os = $platform),*),*))))]
pub const ENOATTR: ::libc::c_int = 0;
pub const SUPPORTED_PLATFORM: bool = cfg!(any($($(target_os = $platform),*),*));
}
}
platforms! {
"linux"; "macos" => linux_macos,
"freebsd"; "netbsd" => bsd
}