actix-handler-macro 0.2.0

Helper macros for using Actix. Generates handlers, actors and address traits.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use syn::Meta;

/// Finds an attribute matching an identifier
pub fn find_attribute_meta(ast: &syn::DeriveInput, attribute: &str) -> Option<Meta> {
    ast.attrs.iter().find_map(|attr| {
        let maybe_meta = attr.parse_meta().ok();
        maybe_meta.and_then(|meta| {
            if meta.path().is_ident(attribute) {
                Some(meta)
            } else {
                None
            }
        })
    })
}