From 7460a12d985edf18cc2ecf402b4e41703841859c Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Fri, 18 Mar 2022 14:09:17 +0100 Subject: [PATCH] Consider generic Params structs in derive macro --- nih_plug_derive/src/params.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nih_plug_derive/src/params.rs b/nih_plug_derive/src/params.rs index a1c4eb27..75e6fb7c 100644 --- a/nih_plug_derive/src/params.rs +++ b/nih_plug_derive/src/params.rs @@ -7,6 +7,7 @@ pub fn derive_params(input: TokenStream) -> TokenStream { let ast = syn::parse_macro_input!(input as syn::DeriveInput); let struct_name = &ast.ident; + let (impl_generics, ty_generics, where_clause) = ast.generics.split_for_impl(); let fields = match ast.data { syn::Data::Struct(syn::DataStruct { fields: syn::Fields::Named(named_fields), @@ -220,7 +221,7 @@ pub fn derive_params(input: TokenStream) -> TokenStream { } quote! { - impl Params for #struct_name { + impl #impl_generics Params for #struct_name #ty_generics #where_clause { fn param_map( self: std::pin::Pin<&Self>, ) -> std::collections::HashMap<&'static str, nih_plug::param::internals::ParamPtr> {