Bug: 154052335

Clone this repo:
  1. 3ebea03 Migrate 25 crates to monorepo am: 7da5263642 by James Farrell · 3 months ago main master
  2. 7da5263 Migrate 25 crates to monorepo by James Farrell · 3 months ago main-16k
  3. d4d5d9f Update Android.bp by running cargo_embargo am: 82f61a1b79 by James Farrell · 3 months ago
  4. 82f61a1 Update Android.bp by running cargo_embargo by James Farrell · 3 months ago
  5. 72b54ae Cleanup license metadata in external/rust/crates/cfg-if. am: 82a8ef8a42 by Wei Li · 3 months ago

cfg-if

Documentation

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"

Example

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();
}

License

This project is licensed under either of

at your option.

Contribution

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.