Enum combine::ParseResult
source · [−]pub enum ParseResult<T, E> {
CommitOk(T),
PeekOk(T),
CommitErr(E),
PeekErr(Tracked<E>),
}
Expand description
A Result
type which has the committed status flattened into the result.
Conversions to and from std::result::Result
can be done using result.into()
or
From::from(result)
Variants
CommitOk(T)
The parser has succeeded and has committed to this parse. If a parser after this fails,
other parser alternatives will not be attempted (CommitErr
will be returned)
PeekOk(T)
The parser has succeeded and has not committed to this parse. If a parser after this fails,
other parser alternatives will be attempted (PeekErr
will be returned)
CommitErr(E)
The parser failed other parse alternatives will not be attempted.
PeekErr(Tracked<E>)
The parser failed but other parse alternatives may be attempted.
Implementations
sourceimpl<T, E> ParseResult<T, E>
impl<T, E> ParseResult<T, E>
pub fn is_ok(&self) -> bool
pub fn is_err(&self) -> bool
pub fn as_ref(&self) -> ParseResult<&T, &E>
pub fn and_then<F, T2>(self, f: F) -> F::Output where
F: FnOnce(T) -> ParseResult<T2, E>,
pub fn map_err<F, E2>(self, f: F) -> ParseResult<T, F::Output> where
F: FnOnce(E) -> E2,
pub fn map<F, T2>(self, f: F) -> ParseResult<F::Output, E> where
F: FnOnce(T) -> T2,
sourceimpl<O, E> ParseResult<O, E>
impl<O, E> ParseResult<O, E>
pub fn into_result(self) -> StdParseResult2<O, E>
Trait Implementations
sourceimpl<T: Clone, E: Clone> Clone for ParseResult<T, E>
impl<T: Clone, E: Clone> Clone for ParseResult<T, E>
sourcefn clone(&self) -> ParseResult<T, E>
fn clone(&self) -> ParseResult<T, E>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<T: Debug, E: Debug> Debug for ParseResult<T, E>
impl<T: Debug, E: Debug> Debug for ParseResult<T, E>
sourceimpl<O, E> From<Result<(O, Commit<()>), Commit<Tracked<E>>>> for ParseResult<O, E>
impl<O, E> From<Result<(O, Commit<()>), Commit<Tracked<E>>>> for ParseResult<O, E>
sourcefn from(result: StdParseResult2<O, E>) -> ParseResult<O, E>
fn from(result: StdParseResult2<O, E>) -> ParseResult<O, E>
Converts to this type from the input type.
sourceimpl<O, E> Into<Result<(O, Commit<()>), Commit<Tracked<E>>>> for ParseResult<O, E>
impl<O, E> Into<Result<(O, Commit<()>), Commit<Tracked<E>>>> for ParseResult<O, E>
sourcefn into(self) -> StdParseResult2<O, E>
fn into(self) -> StdParseResult2<O, E>
Converts this type into the (usually inferred) input type.
sourceimpl<T: PartialEq, E: PartialEq> PartialEq<ParseResult<T, E>> for ParseResult<T, E>
impl<T: PartialEq, E: PartialEq> PartialEq<ParseResult<T, E>> for ParseResult<T, E>
sourcefn eq(&self, other: &ParseResult<T, E>) -> bool
fn eq(&self, other: &ParseResult<T, E>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &ParseResult<T, E>) -> bool
fn ne(&self, other: &ParseResult<T, E>) -> bool
This method tests for !=
.
impl<T: Copy, E: Copy> Copy for ParseResult<T, E>
impl<T, E> StructuralPartialEq for ParseResult<T, E>
Auto Trait Implementations
impl<T, E> RefUnwindSafe for ParseResult<T, E> where
E: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, E> Send for ParseResult<T, E> where
E: Send,
T: Send,
impl<T, E> Sync for ParseResult<T, E> where
E: Sync,
T: Sync,
impl<T, E> Unpin for ParseResult<T, E> where
E: Unpin,
T: Unpin,
impl<T, E> UnwindSafe for ParseResult<T, E> where
E: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more