We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
quote!
quote_spanned!
&mut TokenStream
Hey! dtolnay, Thanks for your great work! ❤️
I think quote! and quote_spanned! macro should take &mut TokenStream instead of creating new one.
Instead of this:
let import = items.iter().map(|item| quote_spanned!(item.span()=> use #item)); quote! { #(#import)* // ... }
I think it should look something like this:
// `to_tokens_fn` accept closure and return a struct that implement `ToTokens` let import = to_tokens_fn(|tokens| { for item in items { quote_spanned!(tokens, item.span()=> use #item); } }); impl ToTokens for <Struct> { fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream) { quote!(tokens, { #import // ... }) } }
This approach should be more performance, Because it avoid cloning.
Sorry if this is duplicate.
The text was updated successfully, but these errors were encountered:
I would prefer not to support this in this crate.
Sorry, something went wrong.
No branches or pull requests
Hey! dtolnay, Thanks for your great work! ❤️
I think
quote!
andquote_spanned!
macro should take&mut TokenStream
instead of creating new one.Instead of this:
I think it should look something like this:
This approach should be more performance, Because it avoid cloning.
Sorry if this is duplicate.
The text was updated successfully, but these errors were encountered: