Closed Volker-Weissmann closed 2 years ago
The expansion to a b c *
matches the behavior of macro_rules, so I think this is fine.
macro_rules! repro {
($($var:tt),*) => {
stringify!($($var)**)
};
}
fn main() {
println!(repro!(a, b, c));
}
An alternative in both cases would be something like:
let mut rest = var.iter();
let first = rest.next();
quote! { #first #(* #rest)* }
let mut rest = var.iter(); let first = rest.next(); quote! { #first #(* #rest)* }
Thank you, this is what I needed.
#(#var),*
producesa,b,c
, but#(#var)**
does work. How can I producea*b*c
?Currently, I use
#((#var) *)* 1.0
, but this is not a perfect solution