ErrorEnum

Trait ErrorEnum 

Source
pub trait ErrorEnum: Error {
    type Span: Span;
    type Message: Display;

    // Required methods
    fn kind(&self) -> Kind;
    fn number(&self) -> &str;
    fn code(&self) -> &str;
    fn primary_span(&self) -> Self::Span;
    fn primary_message(&self) -> Self::Message;
    fn primary_label(&self) -> Self::Message;
}
Expand description

Trait for error enums generated by [error_type!] macro and [ErrorType] derive macro.

Required Associated Types§

Source

type Span: Span

The span type associated with the error enum.

Source

type Message: Display

The message type associated with the error enum.

Required Methods§

Source

fn kind(&self) -> Kind

Get the kind of the error.

Source

fn number(&self) -> &str

Get the number of the error.

Source

fn code(&self) -> &str

Get the code of the error.

Normally the code is a combination of kind short string and number, like “E0”, “W1”, etc.

Source

fn primary_span(&self) -> Self::Span

Get the primary span of the error.

Source

fn primary_message(&self) -> Self::Message

Get the primary message of the error.

Source

fn primary_label(&self) -> Self::Message

Get the primary label of the error.

Implementations on Foreign Types§

Source§

impl<T> ErrorEnum for &T
where T: ErrorEnum + ?Sized,

Implementors§