miette

Trait IntoDiagnostic

source
pub trait IntoDiagnostic<T, E> {
    // Required method
    fn into_diagnostic(self) -> Result<T, Report>;
}
Expand description

Convenience trait that adds a .into_diagnostic() method that converts a type implementing std::error::Error to a Result<T, Report>.

§Warning

Calling this on a type implementing Diagnostic will reduce it to the common denominator of std::error::Error. Meaning all extra information provided by Diagnostic will be inaccessible. If you have a type implementing Diagnostic consider simply returning it or using Into or the Try operator (?).

Required Methods§

source

fn into_diagnostic(self) -> Result<T, Report>

Converts Result types that return regular std::error::Errors into a Result that returns a Diagnostic.

Implementations on Foreign Types§

source§

impl<T, E: Error + Send + Sync + 'static> IntoDiagnostic<T, E> for Result<T, E>

Implementors§