| commit | bad4b782b0db6012a4bdebd307bec18625d90a63 | [log] [tgz] |
|---|---|---|
| author | Android Build Coastguard Worker <[email protected]> | Thu Feb 17 03:24:54 2022 +0000 |
| committer | Android Build Coastguard Worker <[email protected]> | Thu Feb 17 03:24:54 2022 +0000 |
| tree | 7c1320cae66bd8625a65464d7080232c4d380447 | |
| parent | 68433d6c4a83febfa1320ae68f6e896ee653d25b [diff] | |
| parent | f53aa5f87c66c5e2a9823334d79155fa409e196d [diff] |
Snap for 8191477 from f53aa5f87c66c5e2a9823334d79155fa409e196d to tm-frc-networking-release Change-Id: Iac7f5a1f8d6bf7669447be9b9872b2ce506172ff
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.