commit | fad7dac29aeaf5ab7edf61f8335c03c27121efc4 | [log] [tgz] |
---|---|---|
author | android-build-prod (mdb) <android-build-team-robot@google.com> | Wed Jul 08 00:11:54 2020 +0000 |
committer | android-build-prod (mdb) <android-build-team-robot@google.com> | Wed Jul 08 00:11:54 2020 +0000 |
tree | d585bdf233225a882a5b55ddb7b8cc40fe0d7589 | |
parent | 662a9d14d2803536b073457142c79ac7e989db52 [diff] | |
parent | d91f36e7992c321a0d90183e380c170f3fc0f860 [diff] |
Snap for 6660490 from d91f36e7992c321a0d90183e380c170f3fc0f860 to sdk-release Change-Id: I8df1743633dcf9f90cc0d8524119f2e62316316f
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.