I need to be able to extract the type DieselHandler, ideally in a way that allows for repeatable data_loader attributes for transforming against multiple types.
#[derive(Loadable)]
#[data_loader(handler = DieselHandler<FooLoader>)]
If I use handler: syn::Type
there is the error:
the trait bound
syn::Type: FromMeta
is not satisfied the traitFromMeta
is not implemented forsyn::Type
How can I pass in a type here and maybe even check the wrapper structure?
#[derive(Debug, FromDeriveInput)]
#[darling(attributes(data_loader))]
struct LoadByArgs {
#[darling(default)]
internal: bool,
handler: ????,
}
#[proc_macro_derive(Loadable, attributes(data_loader))]
pub fn load_by(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
let input = parse_macro_input!(input as DeriveInput);
let LoadByArgs {
internal, handler
} = FromDeriveInput::from_derive_input(&input).expect("can't parse attribute");
let expanded = quote! {
...
};
proc_macro::TokenStream::from(expanded)
}