deno_ast::diagnostics

Trait Diagnostic

Source
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§

Source

fn level(&self) -> DiagnosticLevel

The level of the diagnostic.

Source

fn code(&self) -> Cow<'_, str>

The diagnostic code, like no-explicit-any or ban-untagged-ignore.

Source

fn message(&self) -> Cow<'_, str>

The human-readable diagnostic message.

Source

fn location(&self) -> DiagnosticLocation<'_>

The location this diagnostic is associated with.

Source

fn snippet(&self) -> Option<DiagnosticSnippet<'_>>

A snippet showing the source code associated with the diagnostic.

Source

fn hint(&self) -> Option<Cow<'_, str>>

A hint for fixing the diagnostic.

Source

fn snippet_fixed(&self) -> Option<DiagnosticSnippet<'_>>

A snippet showing how the diagnostic can be fixed.

Source

fn info(&self) -> Cow<'_, [Cow<'_, str>]>

Source

fn docs_url(&self) -> Option<Cow<'_, str>>

An optional URL to the documentation for the diagnostic.

Provided Methods§

Source

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.

Implementors§