commit | 8fcc90ed7b0b321c58bd5cfc423ddf47a858f38b | [log] [tgz] |
---|---|---|
author | Xin Li <delphij@google.com> | Mon Nov 23 11:30:29 2020 -0800 |
committer | Xin Li <delphij@google.com> | Mon Nov 23 11:30:29 2020 -0800 |
tree | eb1a804931306e5bdf9e61114225d3c00f1557f3 | |
parent | 0cd662b3b5ca9bb3f1cef8018f7e4623a3c30baa [diff] | |
parent | f5eb3a2f3ec96d710e631b80abd91c8e137b0345 [diff] |
Mark ab/6881855 as merged Bug: 172690556 Change-Id: I3ffca5e81dfc2cf130b9d5088bf69ea3dae41496
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.