darling_core::codegen::attr_extractor

Trait ExtractAttribute

source
pub trait ExtractAttribute {
    // Required methods
    fn local_declarations(&self) -> TokenStream;
    fn attr_names(&self) -> &PathList;
    fn forward_attrs(&self) -> &ForwardAttrs<'_>;
    fn param_name(&self) -> TokenStream;
    fn core_loop(&self) -> TokenStream;

    // Provided methods
    fn attrs_accessor(&self) -> TokenStream { ... }
    fn extractor(&self) -> TokenStream { ... }
}
Expand description

Infrastructure for generating an attribute extractor.

Required Methods§

source

fn local_declarations(&self) -> TokenStream

A set of mutable declarations for all members of the implementing type.

source

fn attr_names(&self) -> &PathList

Gets the list of attribute names that should be parsed by the extractor.

source

fn forward_attrs(&self) -> &ForwardAttrs<'_>

source

fn param_name(&self) -> TokenStream

Gets the name used by the generated impl to return to the syn item passed as input.

source

fn core_loop(&self) -> TokenStream

Gets the core from-meta-item loop that should be used on matching attributes.

Provided Methods§

source

fn attrs_accessor(&self) -> TokenStream

Get the tokens to access a borrowed list of attributes where extraction will take place.

By default, this will be &#input.attrs where #input is self.param_name().

source

fn extractor(&self) -> TokenStream

Generates the main extraction loop.

Implementors§