pub struct FullParsingError<'a, Reason> {
pub loc: FullLocation<'a>,
pub reason: Option<Reason>,
pub src: Cow<'a, str>,
}Expand description
A final error with information about where in the source did the error occur.
This should be constructed at the top-level of a parser as the final action before returning
the result. Main ways to construct this are ParsingError::with_src_loc and
[Parser::with_full_error]
To print the source line of the error along with the reason & location, use the value returned
by its method with_source_line,
this will alter its Display implementation.
Fields§
§loc: FullLocation<'a>Where the error occured.
reason: Option<Reason>What the parser expected to see at the location of the error.
If None, then the error was recoverable and the parser didn’t have any particular
reason.
src: Cow<'a, str>The source code to which the error points.
Implementations§
Source§impl<Reason> FullParsingError<'_, Reason>
impl<Reason> FullParsingError<'_, Reason>
Sourcepub fn own(self) -> FullParsingError<'static, Reason>
pub fn own(self) -> FullParsingError<'static, Reason>
Unbind the error from the lifetimes by allocating the file path if it hasn’t been already.
Trait Implementations§
Source§impl<'a, Reason: Clone> Clone for FullParsingError<'a, Reason>
impl<'a, Reason: Clone> Clone for FullParsingError<'a, Reason>
Source§fn clone(&self) -> FullParsingError<'a, Reason>
fn clone(&self) -> FullParsingError<'a, Reason>
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<'a, Reason: Debug> Debug for FullParsingError<'a, Reason>
impl<'a, Reason: Debug> Debug for FullParsingError<'a, Reason>
Source§impl<Reason: Display> Display for FullParsingError<'_, Reason>
impl<Reason: Display> Display for FullParsingError<'_, Reason>
Source§impl<Reason: Error> Error for FullParsingError<'_, Reason>
impl<Reason: Error> Error for FullParsingError<'_, Reason>
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
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Auto Trait Implementations§
impl<'a, Reason> Freeze for FullParsingError<'a, Reason>where
Reason: Freeze,
impl<'a, Reason> RefUnwindSafe for FullParsingError<'a, Reason>where
Reason: RefUnwindSafe,
impl<'a, Reason> Send for FullParsingError<'a, Reason>where
Reason: Send,
impl<'a, Reason> Sync for FullParsingError<'a, Reason>where
Reason: Sync,
impl<'a, Reason> Unpin for FullParsingError<'a, Reason>where
Reason: Unpin,
impl<'a, Reason> UnwindSafe for FullParsingError<'a, Reason>where
Reason: 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§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more