pub struct ErrorReporter;
Expand description
Utility for generating formatted error reports
Implementations§
Source§impl ErrorReporter
impl ErrorReporter
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new ErrorReporter instance
This is a simple constructor that returns a new instance of the ErrorReporter. Since ErrorReporter has no state, this is equivalent to using the Default implementation.
Sourcepub fn report<W, E>(
&self,
error: &E,
config: &ErrorReportConfig,
writer: &mut W,
) -> Result<()>
pub fn report<W, E>( &self, error: &E, config: &ErrorReportConfig, writer: &mut W, ) -> Result<()>
Report an error to a writer using the provided configuration
Sourcepub fn report_with_syntax<W, E>(
&self,
error: &E,
config: &ErrorReportConfig,
source_code: Option<&str>,
writer: &mut W,
) -> Result<()>
pub fn report_with_syntax<W, E>( &self, error: &E, config: &ErrorReportConfig, source_code: Option<&str>, writer: &mut W, ) -> Result<()>
Report an error with syntax highlighting and AST-aware formatting
This method provides enhanced error reporting with syntax highlighting, code snippets, and AST-aware formatting for better readability.
§Parameters
error
- The error to reportconfig
- Configuration for the error reportsource_code
- Optional source code contextwriter
- The writer to output the report to
§Returns
IO result indicating success or failure
Sourcepub fn report_to_string<E>(
&self,
error: &E,
config: &ErrorReportConfig,
) -> Stringwhere
E: Error,
pub fn report_to_string<E>(
&self,
error: &E,
config: &ErrorReportConfig,
) -> Stringwhere
E: Error,
Report an error as a string using the provided configuration
Sourcepub fn report_to_string_with_syntax<E>(
&self,
error: &E,
config: &ErrorReportConfig,
source_code: Option<&str>,
) -> Stringwhere
E: Error,
pub fn report_to_string_with_syntax<E>(
&self,
error: &E,
config: &ErrorReportConfig,
source_code: Option<&str>,
) -> Stringwhere
E: Error,
Trait Implementations§
Source§impl Debug for ErrorReporter
impl Debug for ErrorReporter
Source§impl Default for ErrorReporter
impl Default for ErrorReporter
Source§fn default() -> ErrorReporter
fn default() -> ErrorReporter
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ErrorReporter
impl RefUnwindSafe for ErrorReporter
impl Send for ErrorReporter
impl Sync for ErrorReporter
impl Unpin for ErrorReporter
impl UnwindSafe for ErrorReporter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more