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§
sourcefn local_declarations(&self) -> TokenStream
fn local_declarations(&self) -> TokenStream
A set of mutable declarations for all members of the implementing type.
sourcefn attr_names(&self) -> &PathList
fn attr_names(&self) -> &PathList
Gets the list of attribute names that should be parsed by the extractor.
fn forward_attrs(&self) -> &ForwardAttrs<'_>
sourcefn param_name(&self) -> TokenStream
fn param_name(&self) -> TokenStream
Gets the name used by the generated impl to return to the syn
item passed as input.
sourcefn core_loop(&self) -> TokenStream
fn core_loop(&self) -> TokenStream
Gets the core from-meta-item loop that should be used on matching attributes.
Provided Methods§
sourcefn attrs_accessor(&self) -> TokenStream
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()
.
sourcefn extractor(&self) -> TokenStream
fn extractor(&self) -> TokenStream
Generates the main extraction loop.