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: SourceCode
Implementations§
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.
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)>
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 !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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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