pub enum EasyMaybe<T> {
Nothing,
Just(T),
}
Expand description
Similar to Option
but implements Parse
when T
implements EasyPeek
If stream doesn’t start as T
then no tokens are consumed and EasyMaybe::Nothing
is returned.
Otherwise T
is parsed and returned wrapped in EasyMaybe::Just
.
Variants§
Trait Implementations§
source§impl<T: Ord> Ord for EasyMaybe<T>
impl<T: Ord> Ord for EasyMaybe<T>
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<T> Parse for EasyMaybe<T>where
T: EasyPeek,
impl<T> Parse for EasyMaybe<T>where T: EasyPeek,
fn parse(input: ParseStream<'_>) -> Result<Self>
source§impl<T: PartialEq> PartialEq<EasyMaybe<T>> for EasyMaybe<T>
impl<T: PartialEq> PartialEq<EasyMaybe<T>> for EasyMaybe<T>
source§impl<T: PartialOrd> PartialOrd<EasyMaybe<T>> for EasyMaybe<T>
impl<T: PartialOrd> PartialOrd<EasyMaybe<T>> for EasyMaybe<T>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read more