use quote::ToTokens;
use struct_data::{Field, StructData};
use syn;
pub fn construct_type(
struct_data: &StructData,
name: &syn::Path,
derives: &[syn::Ident],
) -> impl ToTokens {
let (_impl_generics, ty_generics, where_clause) = struct_data.generics.split_for_impl();
let fields = struct_data
.field_idents
.iter()
.map(|Field { id, ty }| quote!( #id: #ty ));
quote!(
#[derive(#(#derives),*)]
struct #name #ty_generics #where_clause {
#( #fields ),*
}
)
}