pub trait FrontendError<K: Display>: Error {
// Required methods
fn kind(&self) -> &K;
fn text(&self) -> &str;
fn span(&self) -> &Span;
// Provided methods
fn format_error(&self, f: &mut Formatter<'_>) -> Result { ... }
fn notate(&self) -> String { ... }
}Expand description
A trait for representing frontend errors in the bulloak-syntax crate.
This trait is implemented by various error types in the crate to provide a consistent interface for error handling and formatting.
Required Methods§
Provided Methods§
Sourcefn format_error(&self, f: &mut Formatter<'_>) -> Result
fn format_error(&self, f: &mut Formatter<'_>) -> Result
Formats the error message with additional context.
This method provides a default implementation that creates a formatted error message including the error kind, the relevant text, and visual indicators of where the error occurred.
§Arguments
f- A mutable reference to afmt::Formatter.
§Returns
A fmt::Result indicating whether the formatting was successful.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".