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§
Required Methods§
Sourcefn code(&self) -> &str
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.
Sourcefn primary_span(&self) -> Self::Span
fn primary_span(&self) -> Self::Span
Get the primary span of the error.
Sourcefn primary_message(&self) -> Self::Message
fn primary_message(&self) -> Self::Message
Get the primary message of the error.
Sourcefn primary_label(&self) -> Self::Message
fn primary_label(&self) -> Self::Message
Get the primary label of the error.