| commit | 705d64cc4621b0198282c0d5aea8f073eec7a9e5 | [log] [tgz] |
|---|---|---|
| author | Android Build Coastguard Worker <[email protected]> | Tue Sep 10 23:08:45 2024 +0000 |
| committer | Android Build Coastguard Worker <[email protected]> | Tue Sep 10 23:08:45 2024 +0000 |
| tree | 1ee36a19abf2c98eb4597245c6198d7b3ccb919b | |
| parent | b15f64cad45713ef8f4bfd63258f8adf75211a0b [diff] | |
| parent | 3ebea032a3afdfe6d54f4b34d49569c4db33910c [diff] |
Snap for 12349386 from 3ebea032a3afdfe6d54f4b34d49569c4db33910c to sdk-release Change-Id: I44dac9066b640e0d80416842553e430081f06d2a
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.