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_expansion
parser
Allows simple unit testing of proc macro implementations. - assert_tokens
parser
Asserts that thelhs
matches the tokens wrapped in braces on therhs
.
Structs§
- TokenParser
parser
Wrapper forTokenStream::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§
- Trait to test for delimiters of groups
- TokenStream2Ext
proc-macro2
Generic extensions forproc_macro2::TokenStream
- TokenStreamExt
proc-macro
Generic extensions forproc_macro::TokenStream
- TokenTree2Ext
proc-macro2
Generic extensions forproc_macro2::TokenTree
- TokenTreeExt
proc-macro
Generic extensions forproc_macro::TokenTree
- Trait to parse literals
- Trait to test for punctuation