EasyArgumentGroup

Trait EasyArgumentGroup 

Source
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.

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.

Implementors§