use syn::{Attribute, DataStruct, Meta, parse_quote};
use crate::EMBED;
pub(crate) fn basic_embed_fields(data_struct: &DataStruct) -> impl Iterator<Item = &syn::Field> {
data_struct.fields.iter().filter(|field| {
field.attrs.iter().any(|attribute| match attribute {
Attribute {
meta: Meta::Path(path),
..
} => path.is_ident(EMBED),
_ => false,
})
})
}
pub(crate) fn add_struct_bounds(generics: &mut syn::Generics, field_type: &syn::Type) {
let where_clause = generics.make_where_clause();
where_clause.predicates.push(parse_quote! {
#field_type: Embed
});
}