I currently have a macro like this one:
macro_rules! modules {
($($n:ident,)*) => {
$(
mod $n;
)*
};
}
I use it to create a lot of modules.
All the module identifiers begin with a p
and then have a number.
Currently I have to write modules![p1, p2, p3,]
, but I'd prefer if I were able to just write the numbers and the macro were doing its magic to transform them, such that modules![1]
were generating mod p1;
.
I already found interpolate_idents
, but it requires the distinct tokens to be valid identifiers already.