Macro synstructure::decl_attribute[][src]

macro_rules! decl_attribute {
    ([$attribute : ident] => $(#[$($attrs : tt) *]) * $inner : path) => { ... };
}
Expand description

The decl_attribute! macro declares a custom attribute wrapper. It will parse the incoming TokenStream into a synstructure::Structure object, and pass it into the inner function.

Your inner function should have the following type:

fn attribute(
    attr: proc_macro2::TokenStream,
    structure: synstructure::Structure,
) -> proc_macro2::TokenStream {
    unimplemented!()
}

Usage

fn attribute_interesting(
    _attr: proc_macro2::TokenStream,
    _structure: synstructure::Structure,
) -> proc_macro2::TokenStream {
    quote::quote! { ... }
}

decl_attribute!([interesting] => attribute_interesting);

This macro is available if synstructure is built with the "proc-macro" feature.