Typed-quote: A fully typed quote!() alternative for both proc-macro and proc-macro2

Hi, I made a library called typed-quote. It acts like quote but doesn’t depend on proc-macro2.

proc-macro and proc-macro2 are optional features so you can choose any one, both or none of them.

This is useful when you’re just writing a small proc macro library.

For example:

quote!(hello #var).into_token_stream() // returns proc_macro::TokenStream

quote!(hello #var).into_token_stream2() // returns proc_macro2::TokenStream

typed-quote also provides trait WithSpan. Method with_default_span sets span for unspanned tokens, while method with_replaced_span replaces all spans.

See the docs here:purple_heart:

2 Likes