Enum kalosm_sample::ParseResult
source · pub enum ParseResult<'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
Fields
§
new_state: PThe new state of the parser.
The parser is incomplete.
Finished
The parser is finished.
Implementations§
source§impl<'a, P, R> ParseResult<'a, P, R>
impl<'a, P, R> ParseResult<'a, P, R>
sourcepub fn without_remaining(self) -> ParseResult<'static, P, R>
pub fn without_remaining(self) -> ParseResult<'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) -> ParseResult<'a, P, O>where
F: FnOnce(R) -> O,
pub fn map<F, O>(self, f: F) -> ParseResult<'a, P, O>where
F: FnOnce(R) -> O,
Map the result of the parser.
sourcepub fn map_state<F, O>(self, f: F) -> ParseResult<'a, O, R>where
F: FnOnce(P) -> O,
pub fn map_state<F, O>(self, f: F) -> ParseResult<'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 ParseResult<'a, P, R>
impl<'a, P: Clone, R: Clone> Clone for ParseResult<'a, P, R>
source§fn clone(&self) -> ParseResult<'a, P, R>
fn clone(&self) -> ParseResult<'a, P, R>
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<P, R> From<ParseResult<'_, P, R>> for OwnedParseResult<P, R>
impl<P, R> From<ParseResult<'_, P, R>> for OwnedParseResult<P, R>
source§fn from(result: ParseResult<'_, P, R>) -> Self
fn from(result: ParseResult<'_, P, R>) -> Self
Converts to this type from the input type.
source§impl<'a, P: PartialEq, R: PartialEq> PartialEq for ParseResult<'a, P, R>
impl<'a, P: PartialEq, R: PartialEq> PartialEq for ParseResult<'a, P, R>
source§fn eq(&self, other: &ParseResult<'a, P, R>) -> bool
fn eq(&self, other: &ParseResult<'a, P, R>) -> bool
This method tests for
self and other values to be equal, and is used
by ==.impl<'a, P: Eq, R: Eq> Eq for ParseResult<'a, P, R>
impl<'a, P, R> StructuralPartialEq for ParseResult<'a, P, R>
Auto Trait Implementations§
impl<'a, P, R> RefUnwindSafe for ParseResult<'a, P, R>where
P: RefUnwindSafe,
R: RefUnwindSafe,
impl<'a, P, R> Send for ParseResult<'a, P, R>
impl<'a, P, R> Sync for ParseResult<'a, P, R>
impl<'a, P, R> Unpin for ParseResult<'a, P, R>
impl<'a, P, R> UnwindSafe for ParseResult<'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
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.