[][src]Trait aspect::Weave

pub trait Weave: ParseAttributes {
    type MacroAttributes: Parse;
    fn update_fn_block(
        fn_def: &ImplItemMethod,
        main_attr: &Self::MacroAttributes,
        fn_attr: &[Rc<Self::Type>]
    ) -> Result<Block, Error>; fn parse_macro_attributes(
        attrs: TokenStream
    ) -> Result<Self::MacroAttributes, Error> { ... } }

A trait to "Weave" an impl block, that is update each annotated method with your custom logic

This trait extends Synattra's ParseAttributes that parses custom, non-macro attributes that are attached to the impl block or methods.

Associated Types

type MacroAttributes: Parse

The parameters of the macro attribute triggering the weaving, i.e the attributes passed by the compiler to your custom procedural macro.

Loading content...

Required methods

fn update_fn_block(
    fn_def: &ImplItemMethod,
    main_attr: &Self::MacroAttributes,
    fn_attr: &[Rc<Self::Type>]
) -> Result<Block, Error>

A callback that lets you alter the blocks of intercepted methods.

Loading content...

Provided methods

fn parse_macro_attributes(
    attrs: TokenStream
) -> Result<Self::MacroAttributes, Error>

Parse the main macro attributes.

The default implementation should work out-of-the-box.

Loading content...

Implementors

Loading content...