| commit | 62cac580e50c96f78bd32ccdb4974adec0c0f901 | [log] [tgz] |
|---|---|---|
| author | Android Build Coastguard Worker <[email protected]> | Thu Dec 23 02:05:38 2021 +0000 |
| committer | Android Build Coastguard Worker <[email protected]> | Thu Dec 23 02:05:38 2021 +0000 |
| tree | 7c1320cae66bd8625a65464d7080232c4d380447 | |
| parent | ecf894deabcbd36a57d4949bdb80af1e7b0e2816 [diff] | |
| parent | f53aa5f87c66c5e2a9823334d79155fa409e196d [diff] |
Snap for 8023588 from f53aa5f87c66c5e2a9823334d79155fa409e196d to tm-release Change-Id: I04601f791f40528649ac3a673d6fae6ea396628c
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.