pub struct Error<'i> { /* private fields */ }
Expand description
The default error type for parsing
Implementations§
Source§impl<'i> Error<'i>
impl<'i> Error<'i>
Sourcepub fn from_syn(input: Located<'i>, value: Error) -> Self
pub fn from_syn(input: Located<'i>, value: Error) -> Self
Create an error from a syn::Error
and a span
the span should be the input given to the syn parser
Sourcepub fn display_simple(&self) -> String
pub fn display_simple(&self) -> String
Create a string to display the error in a simple format this is usefull for error messages inside editors
Sourcepub fn into_owned(self) -> Error<'static>
pub fn into_owned(self) -> Error<'static>
Create an owned version of the error
pub fn backtrack(self) -> ErrMode<Self>
pub fn cut(self) -> ErrMode<Self>
Trait Implementations§
Source§impl<'i, I: Stream> AddContext<I, Error<'i>> for Error<'i>
impl<'i, I: Stream> AddContext<I, Error<'i>> for Error<'i>
Source§fn add_context(
self,
_input: &I,
_token_start: &<I as Stream>::Checkpoint,
context: Self,
) -> Self
fn add_context( self, _input: &I, _token_start: &<I as Stream>::Checkpoint, context: Self, ) -> Self
Append to an existing error custom data Read more
Source§impl<'i> Diagnostic for Error<'i>
impl<'i> Diagnostic for Error<'i>
Additional related
Diagnostic
s.Source§fn labels(&self) -> Option<Box<dyn Iterator<Item = LabeledSpan> + '_>>
fn labels(&self) -> Option<Box<dyn Iterator<Item = LabeledSpan> + '_>>
Labels to apply to this
Diagnostic
’s Diagnostic::source_code
Source§fn source_code(&self) -> Option<&dyn SourceCode>
fn source_code(&self) -> Option<&dyn SourceCode>
Source code to apply this
Diagnostic
’s Diagnostic::labels
to.Source§fn code<'a>(&'a self) -> Option<Box<dyn Display + 'a>>
fn code<'a>(&'a self) -> Option<Box<dyn Display + 'a>>
Unique diagnostic code that can be used to look up more information
about this
Diagnostic
. Ideally also globally unique, and documented
in the toplevel crate’s documentation for easy searching. Rust path
format (foo::bar::baz
) is recommended, but more classic codes like
E0123
or enums will work just fine.Source§fn severity(&self) -> Option<Severity>
fn severity(&self) -> Option<Severity>
Diagnostic severity. This may be used by
ReportHandler
s to change the display format
of this diagnostic. Read moreSource§fn help<'a>(&'a self) -> Option<Box<dyn Display + 'a>>
fn help<'a>(&'a self) -> Option<Box<dyn Display + 'a>>
Additional help text related to this
Diagnostic
. Do you have any
advice for the poor soul who’s just run into this issue?Source§fn url<'a>(&'a self) -> Option<Box<dyn Display + 'a>>
fn url<'a>(&'a self) -> Option<Box<dyn Display + 'a>>
URL to visit for a more detailed explanation/help about this
Diagnostic
.Source§fn diagnostic_source(&self) -> Option<&dyn Diagnostic>
fn diagnostic_source(&self) -> Option<&dyn Diagnostic>
The cause of the error.
Source§impl<'i> Error for Error<'i>
impl<'i> Error for Error<'i>
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<'i, I> ParserError<I> for Error<'i>
impl<'i, I> ParserError<I> for Error<'i>
Source§fn from_error_kind(input: &I, kind: ErrorKind) -> Self
fn from_error_kind(input: &I, kind: ErrorKind) -> Self
👎Deprecated since 0.6.26: replaced with
ParserError::from_input
Deprecated, replaced with
ParserError::from_input
Source§fn append(
self,
_input: &I,
_token_start: &<I as Stream>::Checkpoint,
_kind: ErrorKind,
) -> Self
fn append( self, _input: &I, _token_start: &<I as Stream>::Checkpoint, _kind: ErrorKind, ) -> Self
Like
ParserError::from_error_kind
but merges it with the existing error. Read moreSource§fn from_input(input: &I) -> Self
fn from_input(input: &I) -> Self
Creates an error from the input position
Auto Trait Implementations§
impl<'i> Freeze for Error<'i>
impl<'i> RefUnwindSafe for Error<'i>
impl<'i> Send for Error<'i>
impl<'i> Sync for Error<'i>
impl<'i> Unpin for Error<'i>
impl<'i> UnwindSafe for Error<'i>
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