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 data like: #[attribute(inner("hello"))]

Implementations

Returns true if this meta item is a path like: #[attribute].

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.