commit | f5eb3a2f3ec96d710e631b80abd91c8e137b0345 | [log] [tgz] |
---|---|---|
author | Chih-Hung Hsieh <chh@google.com> | Thu Aug 27 23:47:09 2020 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Thu Aug 27 23:47:09 2020 +0000 |
tree | 9f53b461009a2611d3ee163fd22cd03401f946fa | |
parent | fcd656341018b52c722ac414a22ba22811da954f [diff] | |
parent | c0039cf166dd9a358083df6359ac3ff615981e1f [diff] |
Fix cfg-if/METADATA am: e27244cbf7 am: f5549b9045 am: 3a66ea74ec am: c0039cf166 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/cfg-if/+/1414003 Change-Id: I67852cb2c04e78036ffd7ae0c5cc45d616b4dcef
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.