pub enum ParseStatus<'a, P, R> {
Incomplete {
new_state: P,
required_next: Cow<'static, str>,
},
Finished {
result: R,
remaining: &'a [u8],
},
}Expand description
The state of a parser.
Variants§
Incomplete
The parser is incomplete.
Fields
§
new_state: PThe new state of the parser.
Finished
The parser is finished.
Implementations§
Source§impl<'a, P, R> ParseStatus<'a, P, R>
impl<'a, P, R> ParseStatus<'a, P, R>
Sourcepub fn without_remaining(self) -> ParseStatus<'static, P, R>
pub fn without_remaining(self) -> ParseStatus<'static, P, R>
Take the remaining bytes from the parser.
Sourcepub fn unwrap_finished(self) -> R
pub fn unwrap_finished(self) -> R
Unwrap the parser to a finished result.
Sourcepub fn unwrap_incomplete(self) -> (P, Cow<'static, str>)
pub fn unwrap_incomplete(self) -> (P, Cow<'static, str>)
Unwrap the parser to an incomplete result.
Sourcepub fn map<F, O>(self, f: F) -> ParseStatus<'a, P, O>where
F: FnOnce(R) -> O,
pub fn map<F, O>(self, f: F) -> ParseStatus<'a, P, O>where
F: FnOnce(R) -> O,
Map the result of the parser.
Sourcepub fn map_state<F, O>(self, f: F) -> ParseStatus<'a, O, R>where
F: FnOnce(P) -> O,
pub fn map_state<F, O>(self, f: F) -> ParseStatus<'a, O, R>where
F: FnOnce(P) -> O,
Map the state of the parser.
Trait Implementations§
Source§impl<'a, P: Clone, R: Clone> Clone for ParseStatus<'a, P, R>
impl<'a, P: Clone, R: Clone> Clone for ParseStatus<'a, P, R>
Source§fn clone(&self) -> ParseStatus<'a, P, R>
fn clone(&self) -> ParseStatus<'a, P, R>
Returns a duplicate 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<P, R> From<ParseStatus<'_, P, R>> for OwnedParseResult<P, R>
impl<P, R> From<ParseStatus<'_, P, R>> for OwnedParseResult<P, R>
Source§fn from(result: ParseStatus<'_, P, R>) -> Self
fn from(result: ParseStatus<'_, P, R>) -> Self
Converts to this type from the input type.
impl<'a, P: Eq, R: Eq> Eq for ParseStatus<'a, P, R>
impl<'a, P, R> StructuralPartialEq for ParseStatus<'a, P, R>
Auto Trait Implementations§
impl<'a, P, R> Freeze for ParseStatus<'a, P, R>
impl<'a, P, R> RefUnwindSafe for ParseStatus<'a, P, R>where
P: RefUnwindSafe,
R: RefUnwindSafe,
impl<'a, P, R> Send for ParseStatus<'a, P, R>
impl<'a, P, R> Sync for ParseStatus<'a, P, R>
impl<'a, P, R> Unpin for ParseStatus<'a, P, R>
impl<'a, P, R> UnwindSafe for ParseStatus<'a, P, R>where
P: UnwindSafe,
R: 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