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
83
84
85
86
87
88
89
90
91
92
pub fn arch() -> &'static str {
#[cfg(target_arch = "aarch64" )] { "aarch64" }
#[cfg(target_arch = "arm" )] { "arm" }
#[cfg(target_arch = "asmjs" )] { "asmjs" }
#[cfg(target_arch = "hexagon" )] { "hexagon" }
#[cfg(target_arch = "mips" )] { "mips" }
#[cfg(target_arch = "msp430" )] { "msp430" }
#[cfg(target_arch = "powerpc" )] { "powerpc" }
#[cfg(target_arch = "powerpc64")] { "powerpc64" }
#[cfg(target_arch = "s390x" )] { "s390x" }
#[cfg(target_arch = "sparc" )] { "sparc" }
#[cfg(target_arch = "wasm32" )] { "wasm32" }
#[cfg(target_arch = "x86" )] { "x86" }
#[cfg(target_arch = "x86_64" )] { "x86_64" }
#[cfg(target_arch = "xcore" )] { "xcore" }
}
pub fn os() -> &'static str {
#[cfg(target_os = "android" )] { "android" }
#[cfg(target_os = "bitrig" )] { "bitrig" }
#[cfg(target_os = "dragonfly" )] { "dragonfly" }
#[cfg(target_os = "emscripten")] { "emscripten" }
#[cfg(target_os = "freebsd" )] { "freebsd" }
#[cfg(target_os = "haiku" )] { "haiku" }
#[cfg(target_os = "ios" )] { "ios" }
#[cfg(target_os = "linux" )] { "linux" }
#[cfg(target_os = "macos" )] { "macos" }
#[cfg(target_os = "netbsd" )] { "netbsd" }
#[cfg(target_os = "openbsd" )] { "openbsd" }
#[cfg(target_os = "solaris" )] { "solaris" }
#[cfg(target_os = "windows" )] { "windows" }
}
pub fn os_family() -> &'static str {
#[cfg(unix )] { "unix" }
#[cfg(windows)] { "windows" }
}
pub fn env() -> &'static str {
#[cfg(target_env = "gnu" )] { "gnu" }
#[cfg(target_env = "msvc")] { "msvc" }
#[cfg(target_env = "musl")] { "musl" }
#[cfg(target_env = "" )] { "" }
}
pub fn endian() -> &'static str {
#[cfg(target_endian = "big" )] { "big" }
#[cfg(target_endian = "little")] { "little" }
}
pub fn pointer_width() -> &'static str {
#[cfg(target_pointer_width = "32")] { "32" }
#[cfg(target_pointer_width = "64")] { "64" }
}
pub fn test() -> bool {
#[cfg(test )] { true }
#[cfg(not(test))] { false }
}