commit | b0aa0a14115132e8f1459c1f96c3575f0296b9fe | [log] [tgz] |
---|---|---|
author | Bernie Innocenti <codewiz@google.com> | Sat Dec 12 02:56:50 2020 +0900 |
committer | Bernie Innocenti <codewiz@google.com> | Mon Dec 14 21:48:40 2020 +0900 |
tree | 3ac09c51d21c811b6f60ef1d2e4e2f3c28705471 | |
parent | 8fcc90ed7b0b321c58bd5cfc423ddf47a858f38b [diff] |
Allow using cfg-if from DnsResolver Test: m Bug: 155855709 Change-Id: I3a6ff461480cef5466c35618c24f3bc7153682df
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.