Opinion: `proc_macro::TokenStream` should implement Extend<proc_macro::Group>, etc

At the moment of writing, proc_macro::TokenStream implements core::iter::Extend of proc_macro::TokenStream and proc_macro::TokenTree, i.e. Extend<TokenStream> and Extend<TokenTree>.

I believe that it would be reasonable to provide implementations for all of the types that can be stored in variants of proc_macro::TokenTree, namely

  1. proc_macro::Group
  2. proc_macro::Ident
  3. proc_macro::Punct
  4. proc_macro::Literal

Is there any reason not to provide these implementations?

I'd file an ACP for this. It's more than reasonable and trivial to implement.

1 Like

Done:

1 Like

Thanks!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.