pub struct ParseError {
pub message: String,
pub span: Option<Span>,
pub kind: ParseErrorKind,
pub recoverable: bool,
}Expand description
A parse error with location and recovery information.
Fields§
§message: StringHuman-readable error message
span: Option<Span>Source location where the error occurred
kind: ParseErrorKindError categorization
recoverable: boolWhether parsing can continue after this error
Implementations§
Source§impl ParseError
impl ParseError
Sourcepub fn unexpected_eof(span: Option<Span>) -> Self
pub fn unexpected_eof(span: Option<Span>) -> Self
Create an error for unexpected end of input.
Sourcepub fn unclosed_delimiter(delimiter: &str, span: Option<Span>) -> Self
pub fn unclosed_delimiter(delimiter: &str, span: Option<Span>) -> Self
Create an error for unclosed delimiters.
Sourcepub fn invalid_syntax(context: &str, span: Option<Span>) -> Self
pub fn invalid_syntax(context: &str, span: Option<Span>) -> Self
Create an error for invalid syntax.
Sourcepub fn unknown_directive(directive: &str, span: Option<Span>) -> Self
pub fn unknown_directive(directive: &str, span: Option<Span>) -> Self
Create an error for unknown directives.
Sourcepub fn with_kind(self, kind: ParseErrorKind) -> Self
pub fn with_kind(self, kind: ParseErrorKind) -> Self
Set the error kind.
Sourcepub fn non_recoverable(self) -> Self
pub fn non_recoverable(self) -> Self
Mark this error as non-recoverable.
Trait Implementations§
Source§impl Clone for ParseError
impl Clone for ParseError
Source§fn clone(&self) -> ParseError
fn clone(&self) -> ParseError
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 Debug for ParseError
impl Debug for ParseError
Source§impl Display for ParseError
impl Display for ParseError
Source§impl Error for ParseError
impl Error for ParseError
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()
Source§impl PartialEq for ParseError
impl PartialEq for ParseError
impl Eq for ParseError
impl StructuralPartialEq for ParseError
Auto Trait Implementations§
impl Freeze for ParseError
impl RefUnwindSafe for ParseError
impl Send for ParseError
impl Sync for ParseError
impl Unpin for ParseError
impl UnwindSafe for ParseError
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