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§
source§impl<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::Outputwhere
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,
source§impl<O, E> ParseResult<O, E>
impl<O, E> ParseResult<O, E>
pub fn into_result(self) -> StdParseResult2<O, E>
Trait Implementations§
source§impl<T: Clone, E: Clone> Clone for ParseResult<T, E>
impl<T: Clone, E: Clone> Clone for ParseResult<T, E>
source§fn clone(&self) -> ParseResult<T, E>
fn clone(&self) -> ParseResult<T, E>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<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>
source§fn 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.
source§impl<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>
source§fn into(self) -> StdParseResult2<O, E>
fn into(self) -> StdParseResult2<O, E>
Converts this type into the (usually inferred) input type.
impl<T: Copy, E: Copy> Copy for ParseResult<T, E>
impl<T, E> StructuralPartialEq for ParseResult<T, E>
Auto Trait Implementations§
impl<T, E> Freeze for ParseResult<T, E>
impl<T, E> RefUnwindSafe for ParseResult<T, E>where
T: RefUnwindSafe,
E: RefUnwindSafe,
impl<T, E> Send for ParseResult<T, E>
impl<T, E> Sync for ParseResult<T, E>
impl<T, E> Unpin for ParseResult<T, E>
impl<T, E> UnwindSafe for ParseResult<T, E>where
T: UnwindSafe,
E: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)