pub trait EasyArgumentField {
    fn try_parse(
        lookahead1: &Lookahead1<'_>,
        stream: ParseStream<'_>
    ) -> Result<Option<Self>>
    where
        Self: Sized
; fn try_extend(
        &mut self,
        lookahead1: &Lookahead1<'_>,
        stream: ParseStream<'_>
    ) -> Result<bool>; fn missing() -> Result<Self, String>
    where
        Self: Sized
; }
Expand description

Trait for types that can be used as fields in easy attributes structures. Fields can parsed and extended when encountered again in parsing stream. If field is never encountered - [missing] value will be used. If attribute type or group is not mandatory - wrap it into Option.

Required Methods

Attempt to parse attribute field. Returns some field when parsing succeeds. Returns none if attribute peeking returns false, signalling that stream contains some other attribute. Returns error if peeking returns true but parsing fails.

Attempt to parse attribute field when it already has been successfully parsed. Field value should extend itself with newly parsed attribute or return error. Returns true when parsing and extending succeeds. Returns false if attribute peeking returns false, signalling that stream contains some other attribute. Returns error if peeking returns true but parsing or extending fails.

Called if the attribute field was never parsed. Returns error if attribute is mandatory. Otherwise returns an instance that will be used to build attributes structure.

Implementations on Foreign Types

Implementors