commit | beda42cbfe50baa8020d287151334b841cd4c504 | [log] [tgz] |
---|---|---|
author | Scott Lobdell <slobdell@google.com> | Sun Jan 30 02:48:12 2022 +0000 |
committer | Scott Lobdell <slobdell@google.com> | Sun Jan 30 03:02:31 2022 +0000 |
tree | 7c1320cae66bd8625a65464d7080232c4d380447 | |
parent | 7aea746d3d3b0303f3ec3c73c84e8f729f3034f1 [diff] | |
parent | 62cac580e50c96f78bd32ccdb4974adec0c0f901 [diff] |
Merge TP1A.220107.002 Change-Id: Idbbd6b3a4abd18b06120267bab5f227d9f17544f
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.