• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

.github/workflows/23-Nov-2023-5753

patches/23-Nov-2023-1513

src/23-Nov-2023-180119

tests/23-Nov-2023-1513

.cargo_vcs_info.jsonD23-Nov-202374 65

.gitignoreD23-Nov-202318 32

Android.bpD23-Nov-20232.7 KiB10090

Cargo.tomlD23-Nov-20231.3 KiB3733

Cargo.toml.origD23-Nov-2023792 2622

LICENSED23-Nov-202310.6 KiB202169

LICENSE-APACHED23-Nov-202310.6 KiB202169

LICENSE-MITD23-Nov-20231 KiB2622

METADATAD23-Nov-2023513 2019

MODULE_LICENSE_APACHE2D23-Nov-20230

OWNERSD23-Nov-202340 21

README.mdD23-Nov-20231.1 KiB4835

TEST_MAPPINGD23-Nov-2023570 3029

cargo2android.jsonD23-Nov-2023212 1212

README.md

1# cfg-if
2
3[Documentation](https://docs.rs/cfg-if)
4
5A macro to ergonomically define an item depending on a large number of #[cfg]
6parameters. Structured like an if-else chain, the first matching branch is the
7item that gets emitted.
8
9```toml
10[dependencies]
11cfg-if = "0.1"
12```
13
14## Example
15
16```rust
17cfg_if::cfg_if! {
18    if #[cfg(unix)] {
19        fn foo() { /* unix specific functionality */ }
20    } else if #[cfg(target_pointer_width = "32")] {
21        fn foo() { /* non-unix, 32-bit functionality */ }
22    } else {
23        fn foo() { /* fallback implementation */ }
24    }
25}
26
27fn main() {
28    foo();
29}
30```
31
32# License
33
34This project is licensed under either of
35
36 * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
37   http://www.apache.org/licenses/LICENSE-2.0)
38 * MIT license ([LICENSE-MIT](LICENSE-MIT) or
39   http://opensource.org/licenses/MIT)
40
41at your option.
42
43### Contribution
44
45Unless you explicitly state otherwise, any contribution intentionally submitted
46for inclusion in `cfg-if` by you, as defined in the Apache-2.0 license, shall be
47dual licensed as above, without any additional terms or conditions.
48