Macro proc_macro_utils::assert_tokens
source ยท macro_rules! assert_tokens { ($lhs:expr, { $($rhs:tt)* }) => { ... }; }
Available on crate feature
parser
only.Expand description
Asserts that the lhs
matches the tokens wrapped in braces on the rhs
.
lhs
needs to be an expression implementing IntoIterator<Item=TokenTree>
e.g. TokenStream
or
TokenParser
.
let some_tokens = quote! { ident, { group } };
assert_tokens! {some_tokens, { ident, {group} }};