From 697301cd1a6be146c802cdaba7e19ccbdbb860c1 Mon Sep 17 00:00:00 2001 From: UnexDev <26cgould2@gmail.com> Date: Mon, 10 Jun 2024 11:27:57 -0400 Subject: [PATCH] Add generics to function_no_cache --- cached_proc_macro/src/cached.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cached_proc_macro/src/cached.rs b/cached_proc_macro/src/cached.rs index 95ca368..fc63555 100644 --- a/cached_proc_macro/src/cached.rs +++ b/cached_proc_macro/src/cached.rs @@ -64,6 +64,7 @@ pub fn cached(args: TokenStream, input: TokenStream) -> TokenStream { let inputs = signature.inputs.clone(); let output = signature.output.clone(); let asyncness = signature.asyncness; + let generics = signature.generics.clone(); let input_tys = get_input_types(&inputs); let input_names = get_input_names(&inputs); @@ -210,7 +211,7 @@ pub fn cached(args: TokenStream, input: TokenStream) -> TokenStream { }; function_no_cache = quote! { - async fn #no_cache_fn_ident(#inputs) #output #body + async fn #no_cache_fn_ident #generics (#inputs) #output #body }; function_call = quote! { @@ -226,7 +227,7 @@ pub fn cached(args: TokenStream, input: TokenStream) -> TokenStream { }; function_no_cache = quote! { - fn #no_cache_fn_ident(#inputs) #output #body + fn #no_cache_fn_ident #generics (#inputs) #output #body }; function_call = quote! {