commit | b988f24bcf4c9d0b8ea17ac717d256f83116f098 | [log] [tgz] |
---|---|---|
author | Xin Li <delphij@google.com> | Sat Feb 20 00:24:17 2021 -0800 |
committer | Xin Li <delphij@google.com> | Sat Feb 20 00:24:17 2021 -0800 |
tree | 96e7eb8c0153edac20867f21fb1fa0e3d127c959 | |
parent | e4bae8aa7cfd7838ceb787f645dcdedea69c5306 [diff] | |
parent | b66091ba8c5d6ccbd61e40ba4804edfe40d93604 [diff] |
Mark ab/7061308 as merged in stage. Bug: 180401296 Merged-In: I534a4e272fd8cd41d3f04b091994f84a6af13e67 Change-Id: I753db71f5ba14de1d639e694dce4fbd47bf0eec7
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.