Macro mac::match_cfg [] [src]

macro_rules! match_cfg {
    ( $( ($cfg:meta) => $e:expr, )* _ => $last:expr, ) => { ... };
    ( $( ($cfg:meta) => $e:expr, )* ) => { ... };
}

Compile-time matching on config variables.

Only the branch relevant on your machine will be type-checked!

Example

let mascot = match_cfg! {
    (target_os = "linux") => "penguin",
    (target_os = "openbsd") => "blowfish",
    _ => "unknown",
};
println!("{}", mascot);