commit | bad404257ab3e32872b77a03aabeb2adf90322a0 | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Tue Jul 20 03:04:49 2021 +0000 |
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Tue Jul 20 03:04:49 2021 +0000 |
tree | 64fd2f6a3c8aae72991c398bbb95e5cab98fb95c | |
parent | 4648794877ee618110d733938475eeb28a47e8d9 [diff] | |
parent | 17d93348a8f155b9494ca686a6e619f846d2af82 [diff] |
Snap for 7563205 from 17d93348a8f155b9494ca686a6e619f846d2af82 to tm-release Change-Id: Iad6d2a1bfc7f64cd63e61ddb0e49d8699e2f3de6
A macro to ergonomically define an item depending on a large number of #[cfg] parameters. Structured like an if-else chain, the first matching branch is the item that gets emitted.
[dependencies] cfg-if = "0.1"
cfg_if::cfg_if! { if #[cfg(unix)] { fn foo() { /* unix specific functionality */ } } else if #[cfg(target_pointer_width = "32")] { fn foo() { /* non-unix, 32-bit functionality */ } } else { fn foo() { /* fallback implementation */ } } } fn main() { foo(); }
This project is licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in cfg-if
by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.