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§
Sourcefn into_diagnostic(self) -> Result<T, Report>
fn into_diagnostic(self) -> Result<T, Report>
Converts Result
types that return regular std::error::Error
s
into a Result
that returns a Diagnostic
.