dynamic-graphql-derive 0.10.2

Dynamic GraphQL schema macro
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
pub trait Attributes {
    const ATTRIBUTES: &'static [&'static str];
}

pub trait CleanAttributes {
    fn clean_attributes(attrs: &mut Vec<syn::Attribute>);
}

impl<T: Attributes> CleanAttributes for T {
    fn clean_attributes(attrs: &mut Vec<syn::Attribute>) {
        attrs.retain(|attr: &syn::Attribute| {
            !T::ATTRIBUTES.iter().any(|name| attr.path().is_ident(name))
        });
    }
}