Skip to main content

ErrorTypeExt

Trait ErrorTypeExt 

Source
pub trait ErrorTypeExt: ErrorType {
    // Provided methods
    fn fmt_as_annotate_snippets(&self) -> String { ... }
    fn fmt_as_annotate_snippets_with_opts(&self, opts: FormatOptions) -> String { ... }
    fn fmt_as_ariadne_report(&self) -> Result<String, Error> { ... }
    fn fmt_as_ariadne_report_with(
        &self,
        config: Config,
    ) -> Result<String, Error> { ... }
    fn as_codespan_diagnostic(
        &self,
    ) -> (Diagnostic<usize>, SimpleFiles<<Self::Span as Span>::Uri, <Self::Span as Span>::Source>) { ... }
    fn fmt_as_codespan_diagnostic_with(
        &self,
        config: Config,
        styles: Option<&Styles>,
    ) -> Result<String, Error> { ... }
    fn as_miette_diagnostic(&self) -> impl Diagnostic
       where Self::Span: Send + Sync { ... }
    fn fmt_as_miette_diagnostic_with(
        &self,
        handler: &impl ReportHandler,
    ) -> String
       where Self: Sized + 'static,
             Self::Span: Send + Sync { ... }
}
Expand description

Conversion to other diagnostic types.

Provided Methods§

Source

fn fmt_as_annotate_snippets(&self) -> String

Format the error as an annotate snippet.

Source

fn fmt_as_annotate_snippets_with_opts(&self, opts: FormatOptions) -> String

Format the error as an annotate snippet with format options.

Source

fn fmt_as_ariadne_report(&self) -> Result<String, Error>

Format the error as an Ariadne report.

Source

fn fmt_as_ariadne_report_with(&self, config: Config) -> Result<String, Error>

Format the error as an Ariadne report with Ariadne config.

Source

fn as_codespan_diagnostic( &self, ) -> (Diagnostic<usize>, SimpleFiles<<Self::Span as Span>::Uri, <Self::Span as Span>::Source>)

Format the error as an Codespan diagnostic.

Source

fn fmt_as_codespan_diagnostic_with( &self, config: Config, styles: Option<&Styles>, ) -> Result<String, Error>

Format the error as an Codespan diagnostic with Codespan config.

Source

fn as_miette_diagnostic(&self) -> impl Diagnostic
where Self::Span: Send + Sync,

Convert the error to a Miette diagnostic.

Source

fn fmt_as_miette_diagnostic_with(&self, handler: &impl ReportHandler) -> String
where Self: Sized + 'static, Self::Span: Send + Sync,

Format the error as a Miette diagnostic with a Miette handler.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T> ErrorTypeExt for T
where T: ErrorType + ?Sized,