Trait proc_easy::EasyArgumentField
source · pub trait EasyArgumentField {
// Required methods
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 - EasyArgumentField::missing
value will be used.
If attribute type or group is not mandatory - wrap it into Option
.
Required Methods§
sourcefn try_parse(
lookahead1: &Lookahead1<'_>,
stream: ParseStream<'_>
) -> Result<Option<Self>>where
Self: Sized,
fn try_parse( lookahead1: &Lookahead1<'_>, stream: ParseStream<'_> ) -> Result<Option<Self>>where Self: Sized,
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.
sourcefn try_extend(
&mut self,
lookahead1: &Lookahead1<'_>,
stream: ParseStream<'_>
) -> Result<bool>
fn try_extend( &mut self, lookahead1: &Lookahead1<'_>, stream: ParseStream<'_> ) -> Result<bool>
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.