? operator in macros
macro_rules
macros can use ?
, like this:
#![allow(unused)] fn main() { macro_rules! bar { ($(a)?) => {} } }
The ?
will match zero or one repetitions of the pattern, similar to the
already-existing *
for "zero or more" and +
for "one or more."