Trait miette::Diagnostic [−][src]
pub trait Diagnostic: Error { fn code(&self) -> &dyn Display; fn severity(&self) -> Severity; fn help(&self) -> Option<Box<dyn Iterator<Item = &str>>> { ... } fn snippets(&self) -> Option<&[DiagnosticSnippet]> { ... } }
Expand description
Adds rich metadata to your Error that can be used by DiagnosticReporter 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.
Diagnostic severity. This may be used by DiagnosticReporters to change the display format of this diagnostic.
Provided methods
Additional help text related to this Diagnostic. Do you have any advice for the poor soul who’s just run into this issue?