Enum mattro::MetaItem [−][src]
pub enum MetaItem { Path(String), Literal(Lit), NameValue(NameValue), Nested(MacroAttribute), }
Expand description
Represents the data in an attribute.
Variants
Path(String)
A path like: #[attribute]
Literal(Lit)
A literal like: #[attribute("hello world")]
NameValue(NameValue)
A key-value like: #[attribute(key="value")]
or #[attribute(array=1,2,3,4)]
Nested(MacroAttribute)
Nested data like: #[attribute(inner("hello"))]
Implementations
Returns true
if this meta item is a literal like: #[attribute("hola mundo")]
.
Returns true
if this meta item is a name-value pair like: #[attribute(name="value")]
.
Returns true
if this meta item is a nested attribute like: #[attribute(inner("hello"))]
.
Converts this meta item into a String
or None
if is not a path.
Converts this meta item into a Lit
or None
if is not a literal.
Converts this meta item into a NameValue
or None
if is not a name-value pair.
Converts this meta item into a its inner MacroAttribute
or None
if is not a nested attribute.
Returns a reference to this meta item as a &str
or None
if is not a path.
Returns a reference to this meta item as a Lit
or None
if is not a literal.
Returns a reference to this meta item as a NameValue
or None
if is not a name-value pair.
Returns a reference to this meta item as a nested macro attribute or None
if is not a macro attribute.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for MetaItem
impl UnwindSafe for MetaItem
Blanket Implementations
Mutably borrows from an owned value. Read more