Crate proc_macro_utils

Source
Expand description

Some useful functions on proc_macro and proc_macro2 types

E.g. pushing tokens onto TokenStream and testing for specific punctuation on TokenTree and Punct

It also adds the assert_tokens! and assert_expansion! macros to improve unit testability for proc-macros.

Macros§

assert_expansionparser
Allows simple unit testing of proc macro implementations.
assert_tokensparser
Asserts that the lhs matches the tokens wrapped in braces on the rhs.

Structs§

TokenParserparser
Wrapper for TokenStream::into_iter allowing not only to iterate on tokens but also to parse simple structures like types or expressions, though it does not make any claims about their correctness.

Traits§

Delimited
Trait to test for delimiters of groups
TokenStream2Extproc-macro2
Generic extensions for proc_macro2::TokenStream
TokenStreamExtproc-macro
Generic extensions for proc_macro::TokenStream
TokenTree2Extproc-macro2
Generic extensions for proc_macro2::TokenTree
TokenTreeExtproc-macro
Generic extensions for proc_macro::TokenTree
TokenTreeLiteral
Trait to parse literals
TokenTreePunct
Trait to test for punctuation