Function rustc_expand::mbe::transcribe::count_repetitions
source · fn count_repetitions<'a>(
cx: &ExtCtxt<'a>,
depth_user: usize,
matched: &NamedMatch,
repeats: &[(usize, usize)],
sp: &DelimSpan
) -> PResult<'a, usize>Expand description
Used solely by the count meta-variable expression, counts the outer-most repetitions at a
given optional nested depth.
For example, a macro parameter of $( { $( $foo:ident ),* } )* called with { a, b } { c }:
[ $( ${count(foo)} ),* ]will return [2, 1] with a, b = 2 and c = 1[ $( ${count(foo, 0)} ),* ]will be the same as[ $( ${count(foo)} ),* ][ $( ${count(foo, 1)} ),* ]will return an error because${count(foo, 1)}is declared inside a single repetition and the index1implies two nested repetitions.