pub trait EasyArgumentGroup {
    // Required methods
    fn try_parse(
        lookahead1: &Lookahead1<'_>,
        stream: ParseStream<'_>
    ) -> Result<Option<Self>>
       where Self: Sized;
    fn overlap_error(&self, other: &Self) -> Error;
    fn missing_error() -> String;
}
Expand description

Trait that should be implemented for enums of where each variant is an attribute. It is also auto-implemented for all bare attributes. This trait is used to implement EasyArgumentField for various types.

Required Methods§

source

fn try_parse( lookahead1: &Lookahead1<'_>, stream: ParseStream<'_> ) -> Result<Option<Self>>where Self: Sized,

Attempt to parse attribute group. Returns some attribute 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.

source

fn overlap_error(&self, other: &Self) -> Error

Produces error with appropriate message when the attribute group overlaps another instance. This is called by certain EasyArgumentField implementations.

For example bare EasyArgumentGroup is used when attributes from group must be specified at most once. And this method will be called when attribute group is encountered second time.

source

fn missing_error() -> String

Produces error with appropriate message when the attribute group is missing. This is called by certain EasyArgumentField implementations.

Implementors§