attribute_derive::parsing

Trait AttributePositional

Source
pub trait AttributePositional: AttributeBase {
    // Required method
    fn parse_positional(
        input: ParseStream<'_>,
    ) -> Result<Option<SpannedValue<Self::Partial>>>;
}
Expand description

Values that can be parsed positionally, i.e., without a name, e.g. "literal", a + b, true.

When deriving FromAttr this behavior is enabled via putting #[attr(positional)] on the field.

The trait is implemented for each AttributeValue that implements the marker trait PositionalValue.

Required Methods§

Source

fn parse_positional( input: ParseStream<'_>, ) -> Result<Option<SpannedValue<Self::Partial>>>

Parses Self, positionally.

Note: This needs to stop parsing at the end of the value, before a possible following , and further arguments.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl AttributePositional for bool

Source§

impl<T: AttributePositional + AttributePeekable> AttributePositional for Option<T>

Implementors§