Macro static_assertions::assert_cfg [] [src]

macro_rules! assert_cfg {
    () => { ... };
    ($msg:expr, $($cfg:tt)*) => { ... };
    ($($cfg:tt)*) => { ... };
}

Asserts that the configuration is set.

Examples

A project may not support a set of configurations and thus you may want to report why:

// We should only be compiling for Unix or Linux
assert_cfg!(any(unix, linux));

If users need to specify a database back-end:

assert_cfg!("Must exclusively use MySQL or MongoDB as database back-end",
            all(not(all(feature = "mysql", feature = "mongodb")),
                any(    feature = "mysql", feature = "mongodb")));