Module cfg_if
Compile-time conditional compilation as if / else blocks.
cfg_if provides the cfg_if! macro,
which allows writing #[cfg] conditional compilation
in a more readable if / else if / else style
instead of repeating #[cfg] attributes with negated conditions.
This is especially useful when selecting between more than two configurations,
where manually writing the correct combination of not(), any(), and all()
becomes error-prone.
Example
use cfg_if;
cfg_if!
let p = platform;
assert!;
Macros
- cfg_if The main macro provided by this crate. See crate documentation for more information.