pub enum ParseError<L, T, E> {
InvalidToken {
location: L,
},
UnrecognizedEof {
location: L,
expected: Vec<String>,
},
UnrecognizedToken {
token: (L, T, L),
expected: Vec<String>,
},
ExtraToken {
token: (L, T, L),
},
User {
error: E,
},
}
Variants§
InvalidToken
Generated by the parser when it encounters a token (or EOF) it did not expect.
Fields
§
location: L
UnrecognizedEof
Generated by the parser when it encounters an EOF it did not expect.
Fields
§
location: L
The end of the final token
UnrecognizedToken
Generated by the parser when it encounters a token it did not expect.
Fields
ExtraToken
Generated by the parser when it encounters additional, unexpected tokens.
User
Custom error type.
Fields
§
error: E
Implementations§
source§impl<L, T, E> ParseError<L, T, E>
impl<L, T, E> ParseError<L, T, E>
pub fn map_location<LL>(self, op: impl FnMut(L) -> LL) -> ParseError<LL, T, E>
pub fn map_token<TT>(self, op: impl FnOnce(T) -> TT) -> ParseError<L, TT, E>
pub fn map_error<EE>(self, op: impl FnOnce(E) -> EE) -> ParseError<L, T, EE>
Trait Implementations§
source§impl<L: Clone, T: Clone, E: Clone> Clone for ParseError<L, T, E>
impl<L: Clone, T: Clone, E: Clone> Clone for ParseError<L, T, E>
source§fn clone(&self) -> ParseError<L, T, E>
fn clone(&self) -> ParseError<L, 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<L, T, E> Display for ParseError<L, T, E>
impl<L, T, E> Display for ParseError<L, T, E>
source§impl<L, T, E> Error for ParseError<L, T, E>
impl<L, T, E> Error for ParseError<L, T, E>
source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
1.30.0 · source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
source§impl<L, T, E> From<E> for ParseError<L, T, E>
impl<L, T, E> From<E> for ParseError<L, T, E>
source§impl<L: Ord, T: Ord, E: Ord> Ord for ParseError<L, T, E>
impl<L: Ord, T: Ord, E: Ord> Ord for ParseError<L, T, E>
source§fn cmp(&self, other: &ParseError<L, T, E>) -> Ordering
fn cmp(&self, other: &ParseError<L, T, E>) -> Ordering
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<L: PartialOrd, T: PartialOrd, E: PartialOrd> PartialOrd for ParseError<L, T, E>
impl<L: PartialOrd, T: PartialOrd, E: PartialOrd> PartialOrd for ParseError<L, T, E>
impl<L: Eq, T: Eq, E: Eq> Eq for ParseError<L, T, E>
impl<L, T, E> StructuralPartialEq for ParseError<L, T, E>
Auto Trait Implementations§
impl<L, T, E> Freeze for ParseError<L, T, E>
impl<L, T, E> RefUnwindSafe for ParseError<L, T, E>
impl<L, T, E> Send for ParseError<L, T, E>
impl<L, T, E> Sync for ParseError<L, T, E>
impl<L, T, E> Unpin for ParseError<L, T, E>
impl<L, T, E> UnwindSafe for ParseError<L, T, E>
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
)