darling_core::options

Trait ParseAttribute

source
pub trait ParseAttribute: Sized {
    // Required method
    fn parse_nested(&mut self, mi: &Meta) -> Result<()>;

    // Provided method
    fn parse_attributes(self, attrs: &[Attribute]) -> Result<Self> { ... }
}
Expand description

Middleware for extracting attribute values. Implementers are expected to override parse_nested so they can apply individual items to themselves, while parse_attributes is responsible for looping through distinct outer attributes and collecting errors.

Required Methods§

source

fn parse_nested(&mut self, mi: &Meta) -> Result<()>

Read a meta-item, and apply its values to the current instance.

Provided Methods§

source

fn parse_attributes(self, attrs: &[Attribute]) -> Result<Self>

Object Safety§

This trait is not object safe.

Implementors§