Trait miette::Diagnostic [−][src]
pub trait Diagnostic: Error {
fn code<'a>(&'a self) -> Box<dyn Display + 'a>;
fn severity(&self) -> Option<Severity> { ... }
fn help<'a>(&'a self) -> Option<Box<dyn Display + 'a>> { ... }
fn snippets(
&self
) -> Option<Box<dyn Iterator<Item = DiagnosticSnippet<'_>>>> { ... }
}
Expand description
Adds rich metadata to your Error that can be used by DiagnosticReportPrinter to print really nice and human-friendly error messages.
Required methods
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.
Provided methods
Diagnostic severity. This may be used by DiagnosticReportPrinters to change the display format of this diagnostic.
If None
, reporters should treat this as Severity::Error
Additional help text related to this Diagnostic. Do you have any advice for the poor soul who’s just run into this issue?