1cfg_if! {
11 if #[cfg(getrandom_backend = "custom")] {
12 mod custom;
13 pub use custom::*;
14 } else if #[cfg(getrandom_backend = "linux_getrandom")] {
15 mod getrandom;
16 mod sanitizer;
17 pub use getrandom::*;
18 } else if #[cfg(getrandom_backend = "linux_raw")] {
19 mod linux_raw;
20 mod sanitizer;
21 pub use linux_raw::*;
22 } else if #[cfg(getrandom_backend = "rdrand")] {
23 mod rdrand;
24 pub use rdrand::*;
25 } else if #[cfg(getrandom_backend = "rndr")] {
26 mod rndr;
27 pub use rndr::*;
28 } else if #[cfg(getrandom_backend = "efi_rng")] {
29 mod efi_rng;
30 pub use efi_rng::*;
31 } else if #[cfg(getrandom_backend = "windows_legacy")] {
32 mod windows_legacy;
33 pub use windows_legacy::*;
34 } else if #[cfg(getrandom_backend = "wasm_js")] {
35 cfg_if! {
36 if #[cfg(feature = "wasm_js")] {
37 mod wasm_js;
38 pub use wasm_js::*;
39 } else {
40 compile_error!(concat!(
41 "The \"wasm_js\" backend requires the `wasm_js` feature \
42 for `getrandom`. For more information see: \
43 https://docs.rs/getrandom/", env!("CARGO_PKG_VERSION"), "/#webassembly-support"
44 ));
45 }
46 }
47 } else if #[cfg(getrandom_backend = "unsupported")] {
48 mod unsupported;
49 pub use unsupported::*;
50 } else if #[cfg(all(target_os = "linux", target_env = ""))] {
51 mod linux_raw;
52 mod sanitizer;
53 pub use linux_raw::*;
54 } else if #[cfg(target_os = "espidf")] {
55 mod esp_idf;
56 pub use esp_idf::*;
57 } else if #[cfg(any(
58 target_os = "haiku",
59 target_os = "redox",
60 target_os = "nto",
61 target_os = "aix",
62 ))] {
63 mod use_file;
64 pub use use_file::*;
65 } else if #[cfg(any(
66 target_os = "macos",
67 target_os = "openbsd",
68 target_os = "vita",
69 target_os = "emscripten",
70 ))] {
71 mod getentropy;
72 pub use getentropy::*;
73 } else if #[cfg(any(
74 all(
82 target_os = "android",
83 any(
84 target_arch = "aarch64",
85 target_arch = "arm",
86 target_arch = "x86",
87 target_arch = "x86_64",
88 ),
89 ),
90 all(
94 target_os = "linux",
95 any(
96 target_arch = "aarch64",
97 target_arch = "arm",
98 target_arch = "powerpc",
99 target_arch = "powerpc64",
100 target_arch = "s390x",
101 target_arch = "x86",
102 target_arch = "x86_64",
103 all(
107 target_env = "musl",
108 not(
109 any(
110 target_arch = "riscv64",
111 target_arch = "riscv32",
112 ),
113 ),
114 ),
115 ),
116 )
117 ))] {
118 mod use_file;
119 mod linux_android_with_fallback;
120 mod sanitizer;
121 pub use linux_android_with_fallback::*;
122 } else if #[cfg(any(
123 target_os = "android",
124 target_os = "linux",
125 target_os = "dragonfly",
126 target_os = "freebsd",
127 target_os = "hurd",
128 target_os = "illumos",
129 target_os = "cygwin",
130 all(target_os = "horizon", target_arch = "arm"),
133 ))] {
134 mod getrandom;
135 #[cfg(any(target_os = "android", target_os = "linux"))]
136 mod sanitizer;
137 pub use getrandom::*;
138 } else if #[cfg(target_os = "solaris")] {
139 mod solaris;
140 pub use solaris::*;
141 } else if #[cfg(target_os = "netbsd")] {
142 mod netbsd;
143 pub use netbsd::*;
144 } else if #[cfg(target_os = "fuchsia")] {
145 mod fuchsia;
146 pub use fuchsia::*;
147 } else if #[cfg(any(
148 target_os = "ios",
149 target_os = "visionos",
150 target_os = "watchos",
151 target_os = "tvos",
152 ))] {
153 mod apple_other;
154 pub use apple_other::*;
155 } else if #[cfg(all(target_arch = "wasm32", target_os = "wasi"))] {
156 cfg_if! {
157 if #[cfg(target_env = "p1")] {
158 mod wasi_p1;
159 pub use wasi_p1::*;
160 } else if #[cfg(target_env = "p2")] {
161 mod wasi_p2;
162 pub use wasi_p2::*;
163 } else {
164 compile_error!(
165 "Unknown version of WASI (only previews 1 and 2 are supported) \
166 or Rust version older than 1.80 was used"
167 );
168 }
169 }
170 } else if #[cfg(target_os = "hermit")] {
171 mod hermit;
172 pub use hermit::*;
173 } else if #[cfg(target_os = "vxworks")] {
174 mod vxworks;
175 pub use vxworks::*;
176 } else if #[cfg(target_os = "solid_asp3")] {
177 mod solid;
178 pub use solid::*;
179 } else if #[cfg(all(windows, target_vendor = "win7"))] {
180 mod windows_legacy;
181 pub use windows_legacy::*;
182 } else if #[cfg(windows)] {
183 mod windows;
184 pub use windows::*;
185 } else if #[cfg(all(target_arch = "x86_64", target_env = "sgx"))] {
186 mod rdrand;
187 pub use rdrand::*;
188 } else if #[cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")))] {
189 cfg_if! {
190 if #[cfg(feature = "wasm_js")] {
191 mod wasm_js;
192 pub use wasm_js::*;
193 } else {
194 compile_error!(concat!(
195 "The wasm32-unknown-unknown targets are not supported by default; \
196 you may need to enable the \"wasm_js\" configuration flag. Note \
197 that enabling the `wasm_js` feature flag alone is insufficient. \
198 For more information see: \
199 https://docs.rs/getrandom/", env!("CARGO_PKG_VERSION"), "/#webassembly-support"
200 ));
201 }
202 }
203 } else {
204 compile_error!(concat!(
205 "target is not supported. You may need to define a custom backend see: \
206 https://docs.rs/getrandom/", env!("CARGO_PKG_VERSION"), "/#custom-backend"
207 ));
208 }
209}