pub macro cfg_match {
({ $($tt:tt)* }) => { ... },
(_ => { $($output:tt)* }) => { ... },
($cfg:meta => $output:tt $($($rest:tt)+)?) => { ... },
}
🔬This is a nightly-only experimental API. (
cfg_match
#115585)Expand description
A macro for defining #[cfg]
match-like statements.
It is similar to the if/elif
C preprocessor macro by allowing definition of a cascade of
#[cfg]
cases, emitting the implementation which matches first.
This allows you to conveniently provide a long list #[cfg]
’d blocks of code
without having to rewrite each clause multiple times.
Trailing _
wildcard match arms are optional and they indicate a fallback branch when
all previous declarations do not evaluate to true.