commit | 8014ff9a604f99fa40262de14df9c41bc097e187 | [log] [tgz] |
---|---|---|
author | Xin Li <delphij@google.com> | Tue Nov 24 02:34:22 2020 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Tue Nov 24 02:34:22 2020 +0000 |
tree | eb1a804931306e5bdf9e61114225d3c00f1557f3 | |
parent | dcd318f4ea1f37ecdb7c281163c41a68238f6710 [diff] | |
parent | f94b78cbe868ad98000d583a02b6db1283e78bd1 [diff] |
Mark ab/6881855 as merged am: 8fcc90ed7b am: f94b78cbe8 Original change: https://googleplex-android-review.googlesource.com/c/platform/external/rust/crates/cfg-if/+/13112769 Change-Id: I7c0d317f9b13609886b5306f8010b6c2b1983d91
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.