What does the tt metavariable type mean in Rust macros?
问题 I'm reading a book about Rust, and start playing with Rust macros. All metavariable types are explained there and have examples, except the last one – tt . According to the book, it is a “a single token tree”. I'm curious, what is it and what is it used for? Can you please provide an example? 回答1: That's a notion introduced to ensure that whatever is in a macro invocation correctly matches () , [] and {} pairs. tt will match any single token or any pair of parenthesis/brackets/braces with