DiagnosticMessage

Trait DiagnosticMessage 

Source
pub trait DiagnosticMessage: Error {
    // Required method
    fn code(&self) -> usize;

    // Provided methods
    fn message(&self) -> String { ... }
    fn labels(&self) -> Vec<Label> { ... }
    fn notes(&self) -> Vec<Note> { ... }
    fn severity(&self) -> Severity { ... }
}
Expand description

A trait that can be implemented by error types to provide diagnostic information about the given error.

Required Methods§

Source

fn code(&self) -> usize

Provided Methods§

Source

fn message(&self) -> String

The subject message of the error.

Defaults to the error message itself.

Source

fn labels(&self) -> Vec<Label>

One or more labels to provide more context for a given error.

Defaults to no labels.

Source

fn notes(&self) -> Vec<Note>

One or more notes shown at the bottom of the diagnostic message.

Defaults to no notes.

Source

fn severity(&self) -> Severity

The severity of the message.

Defaults to error.

Trait Implementations§

Source§

impl From<Error> for Box<dyn DiagnosticMessage>

Source§

fn from(error: Error) -> Self

Converts to this type from the input type.

Implementors§