pub struct Error {
pub kind: ErrorKind,
pub span: Span,
pub contexts: Vec<String>,
pub source: SourceCode,
}Fields§
§kind: ErrorKind§span: Span§contexts: Vec<String>§source: SourceCodeImplementations§
Source§impl Error
impl Error
pub fn fancy_format_str(&self) -> String
Sourcepub fn fancy_format_stderr(&self)
pub fn fancy_format_stderr(&self)
Render a fancy, human-readable output of this error and print it to stderr.
Sourcepub fn fancy_format_write<E: Write + Send>(&self, stderr: &mut E)
pub fn fancy_format_write<E: Write + Send>(&self, stderr: &mut E)
Render a fancy, human-readable output of this error and print it to a std::io::Write.
Sourcefn span_label(&self) -> Option<String>
fn span_label(&self) -> Option<String>
Create the optional span label displayed as an annotation on the underlined span of the error.
Sourcefn code(&self) -> &'static str
fn code(&self) -> &'static str
Return the unique error code for this variant which can be used to refer users to documentation.
fn spans(&self) -> Vec<SpanLabel>
Sourcefn diagnostic(&self) -> Diagnostic
fn diagnostic(&self) -> Diagnostic
Create the primary diagnostic for a given error.
Sourcefn diagnostics(&self) -> Vec<Diagnostic>
fn diagnostics(&self) -> Vec<Diagnostic>
Return the primary diagnostic and all further associated diagnostics (if any) of an error.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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 Freeze for Error
impl !RefUnwindSafe for Error
impl !Send for Error
impl !Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
impl !UnwindSafe for Error
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