commit | bb9eaf9562917719d18415828fe32bb025046f98 | [log] [tgz] |
---|---|---|
author | Joel Galenson <jgalenson@google.com> | Wed Jul 01 22:33:26 2020 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Wed Jul 01 22:33:26 2020 +0000 |
tree | c5933808e739b3235fbd8c064c3114755cd3e154 | |
parent | 5d73ec2453d18ea185ea21ee5c1da60537255775 [diff] | |
parent | 341b0a703f74f7128996a6a26a7ab350ff2cac4b [diff] |
Build for device. am: 341b0a703f Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/cfg-if/+/1352891 Change-Id: Id108bfb19e9f561abbaf6ce08f570750ea3612fe
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.