pub trait Diagnostic {
// Required methods
fn level(&self) -> DiagnosticLevel;
fn code(&self) -> Cow<'_, str>;
fn message(&self) -> Cow<'_, str>;
fn location(&self) -> DiagnosticLocation<'_>;
fn snippet(&self) -> Option<DiagnosticSnippet<'_>>;
fn hint(&self) -> Option<Cow<'_, str>>;
fn snippet_fixed(&self) -> Option<DiagnosticSnippet<'_>>;
fn info(&self) -> Cow<'_, [Cow<'_, str>]>;
fn docs_url(&self) -> Option<Cow<'_, str>>;
// Provided method
fn display(&self) -> DiagnosticDisplay<'_, Self> { ... }
}
Required Methods§
Sourcefn level(&self) -> DiagnosticLevel
fn level(&self) -> DiagnosticLevel
The level of the diagnostic.
Sourcefn code(&self) -> Cow<'_, str>
fn code(&self) -> Cow<'_, str>
The diagnostic code, like no-explicit-any
or ban-untagged-ignore
.
Sourcefn location(&self) -> DiagnosticLocation<'_>
fn location(&self) -> DiagnosticLocation<'_>
The location this diagnostic is associated with.
Sourcefn snippet(&self) -> Option<DiagnosticSnippet<'_>>
fn snippet(&self) -> Option<DiagnosticSnippet<'_>>
A snippet showing the source code associated with the diagnostic.
Sourcefn snippet_fixed(&self) -> Option<DiagnosticSnippet<'_>>
fn snippet_fixed(&self) -> Option<DiagnosticSnippet<'_>>
A snippet showing how the diagnostic can be fixed.
fn info(&self) -> Cow<'_, [Cow<'_, str>]>
Provided Methods§
fn display(&self) -> DiagnosticDisplay<'_, Self>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.