Trait macroific::attr_parse::AttributeOptions
source · pub trait AttributeOptions: Sized {
// Required method
fn from_iter(
span: Span,
attributes: impl IntoIterator<Item = Attribute>
) -> Result<Self, Error>;
// Provided methods
fn from_attr(attribute: Attribute) -> Result<Self, Error> { ... }
fn from_iter_named(
attr_name: &str,
span: Span,
attributes: impl IntoIterator<Item = Attribute>
) -> Result<Self, Error> { ... }
fn from_stream(input: &ParseBuffer<'_>) -> Result<Self, Error> { ... }
}
Available on crate feature
attr_parse
only.Expand description
Options derivable from Attributes
.
Required Methods§
Provided Methods§
sourcefn from_attr(attribute: Attribute) -> Result<Self, Error>
fn from_attr(attribute: Attribute) -> Result<Self, Error>
Parse and construct from an attribute
sourcefn from_iter_named(
attr_name: &str,
span: Span,
attributes: impl IntoIterator<Item = Attribute>
) -> Result<Self, Error>
fn from_iter_named( attr_name: &str, span: Span, attributes: impl IntoIterator<Item = Attribute> ) -> Result<Self, Error>
Shorthand for filtering attributes by name and passing them on to
from_iter
.
The span
is what will be used for printing errors if nothing more appropriate is
available. It’s likely the field or struct you’re parsing.
sourcefn from_stream(input: &ParseBuffer<'_>) -> Result<Self, Error>
fn from_stream(input: &ParseBuffer<'_>) -> Result<Self, Error>
Parse a stream containing options: opt1(val1), opt2(val2)
Object Safety§
This trait is not object safe.