macro_rules! if_empty {
{ { } { $($x:tt)* } $({ $($y:tt)* })? } => { ... };
{ { $($nonempty:tt)+ } { $($x:tt)* } $({ $($y:tt)* })? } => { ... };
}Expand description
Helper for assisting with defining macros that need to expand conditionally when an argument is empty.
ⓘ
if_empty!{ { } { x } { y } } // => x
if_empty!{ { z } { x } { y } } // => y
// etc.Note: The { y } argument may be omitted.