/
View dependency graph
Depends on
- dh-cargo (dh-sequence-cargo)
- cargo, debhelper-compat, libstd-rust-dev, rustc
Used by
- btm 0.14.0+ds+~0+20260601-1
- ddccontrol 3.1.2-4
- forgejo-cli 0.3.0-9
- hippotat 1.3.3
- meli 0.8.13+dfsg-4
- python-cryptography 46.0.7-1
- rust-nix 0.30.1-3
- rust-openssl 0.10.79-1
- rust-prometheus 0.13.4-6
- rust-sequoia-sq 1.3.1-10
- rust-ahash 0.8.12-4.1
- rust-async-process 2.5.0-1
- rust-async-io 2.6.0-1
- rust-async-native-tls 0.5.0-2
- rust-async-signal 0.2.13-1
- rust-bitarray 0.10.0-1
- rust-bitreader 0.3.11-1
- rust-capctl 0.2.4-2
- rust-chardetng 0.1.17-3
- rust-clio 0.3.6-1
Show 63 more
- rust-clircle 0.6.1-3
- rust-close-fds 0.3.2-1
- rust-compact-str 0.9.0-3
- rust-condtype 1.3.0-1
- rust-console-error-panic-hook 0.1.7-1
- rust-cpp-demangle 0.5.1+dfsg-1
- rust-crc32fast 1.5.0-2
- rust-criterion-cycles-per-byte 0.6.1-1
- rust-cstr-argument 0.1.2-1
- rust-cvt 0.1.2-1
- rust-dashmap 6.2.1-1
- rust-diesel-derives 2.3.9-1
- rust-directories-next 2.0.0-1
- rust-dirs-next 2.0.0-2
- rust-dns-lookup 1.0.8-5
- rust-encoding-rs 0.8.35-1
- rust-etcetera 0.11.0-2
- rust-evdev 0.13.2-1
- rust-fast-image-resize 6.0.0-1
- rust-fd-lock 3.0.13-2
- rust-filetime 0.2.29-1
- rust-gstreamer-sys 0.25.2-3
- rust-half 2.7.1-2
- rust-hidapi 2.6.3-1
- rust-hostname 0.4.1-2
- rust-hyper-rustls 0.27.9+ds-1
- rust-ini-core 0.2.0-1
- rust-io-uring 0.7.11-1
- rust-keccak 0.2.0-2
- rust-libloading 0.8.9-1
- rust-libheif-sys 5.3.0+ds-1
- rust-libseccomp 0.4.0-3
- rust-maybe-rayon 0.1.1-1
- rust-md-5 0.11.0-2
- rust-miette 7.6.0-2
- rust-mockall-derive 0.13.0-1
- rust-mockall-double 0.3.1-1
- rust-net2 0.2.39-3
- rust-notify-rust 4.18.0+ds-2
- rust-num-format 0.4.4-1
- rust-parking-lot-core 0.9.12-1
- rust-pathdiff 0.2.3-1
- rust-polling 3.11.0-1
- rust-prometheus 0.13.4-7
- rust-qoi 0.4.1-2
- rust-radium 1.1.1-1
- rust-reflink-copy 0.1.30-1
- rust-ring 0.17.14-5
- rust-rust-ini 0.21.3-1
- rust-rustyline 17.0.2-2
- rust-sha2-0.10 0.10.9-2
- rust-sha1-0.10 0.10.7-1
- rust-sha1 0.11.0-1
- rust-sha2 0.11.0-1
- rust-tester 0.9.1-2
- rust-test-case 3.3.1-7
- rust-thread-local 1.1.10-1
- rust-tokio-native-tls 0.3.1-4
- rust-utmp-classic-raw 0.1.3-3
- rust-vergen-8 8.3.2-9
- rust-wasm-bindgen 0.2.108-1
- btm 0.14.9+ds+~0.1.0+ds-1
- ddccontrol 3.2.0-5
README (full)
cfg-if
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 = "1.0"
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();
}
The cfg_if! block above is expanded to:
#[cfg(unix)]
fn foo() { /* unix specific functionality */ }
#[cfg(all(target_pointer_width = "32", not(unix)))]
fn foo() { /* non-unix, 32-bit functionality */ }
#[cfg(not(any(unix, target_pointer_width = "32")))]
fn foo() { /* fallback implementation */ }
License
This project is licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)
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.
| dir | .github/ |
| dir | debian/ |
| dir | src/ |
| dir | tests/ |
| file | .cargo_vcs_info.json |
| file | .gitignore |
| file | CHANGELOG.md |
| file | Cargo.lock |
| file | Cargo.toml |
| file | Cargo.toml.orig |
| file | LICENSE-APACHE |
| file | LICENSE-MIT |
| file | README.md |