1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
use syn::{DeriveInput, Meta};

pub fn changes(ast: &DeriveInput) -> bool{
    ast.attrs.iter()
        .find(|attr| attr.parse_meta().ok().map(|meta| match meta {
            Meta::Path(ref path) if path.is_ident("changes") => true,
            _ => false,
        }).unwrap_or(false)).is_some()
}

pub fn autochanges(ast: &DeriveInput) -> bool{
    ast.attrs.iter()
        .find(|attr| attr.parse_meta().ok().map(|meta| match meta {
            Meta::Path(ref path) if path.is_ident("autochanges") => true,
            _ => false,
        }).unwrap_or(false)).is_some()
}