Closed DzenanJupic closed 3 years ago
I just ran into a situation where it would be great to have the option to use SyncLazy in quote!.
SyncLazy
quote!
minimal example:
/* --snip -- */ use proc_macro2::{Ident, Span, TokenStream as TokenStream2}; use std::lazy::SyncLazy; use quote::quote; static SOME_GENERIC: SyncLazy<Ident> = SyncLazy(|| Ident::new("GENERIC", Span::call_site())); fn generate() -> TokenStream2 { quote! { fn generated<#SOME_GENERIC>(arg: #SOME_GENERIC) { /* -- snip -- */ } } }
To not break builds using the stable compiler, the new implementations are feature gated.
I just ran into a situation where it would be great to have the option to use
SyncLazy
inquote!
.minimal example:
To not break builds using the stable compiler, the new implementations are feature gated.