Fix cfg-if/METADATA am: e27244cbf7 am: f5549b9045 am: 3a66ea74ec am: c0039cf166

Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/cfg-if/+/1414003

Change-Id: I67852cb2c04e78036ffd7ae0c5cc45d616b4dcef
tree: 9f53b461009a2611d3ee163fd22cd03401f946fa
  1. .github/
  2. src/
  3. tests/
  4. .cargo_vcs_info.json
  5. .gitignore
  6. Android.bp
  7. Cargo.toml
  8. Cargo.toml.orig
  9. LICENSE-APACHE
  10. LICENSE-MIT
  11. METADATA
  12. MODULE_LICENSE_APACHE2
  13. OWNERS
  14. README.md
  15. TEST_MAPPING
README.md

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.