commit | 0de83496582f015c04fba7ea2feef11e043eb291 | [log] [tgz] |
---|---|---|
author | Victor Hsieh <victorhsieh@google.com> | Tue May 11 12:36:09 2021 -0700 |
committer | Victor Hsieh <victorhsieh@google.com> | Thu May 13 11:33:13 2021 -0700 |
tree | e92f4fe177a0e5de1592173245d3d3c23cd3b9fb | |
parent | d0234f2bbf14d8427053bb62cf57ed66f4cf48fa [diff] |
Make available to com.android.compos apex Bug: 186126404 Test: m Change-Id: I84df3d1a232ad8290826d5f48ea68a744b817494
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.