pub trait Err2Anyhow<T> {
// Required method
fn err2anyhow(self) -> Result<T>;
}Expand description
Convenience trait for converting Result<T, E> into anyhow::Result<T>
Typically this is automatically done with the ? operator in Rust and
by default this trait isn’t necessary. With the anyhow crate’s std
feature disabled, however, the ? operator won’t work because the Error
trait is not defined. This trait helps to bridge this gap.
This does the same thing as ? when the std feature is enabled, and when
std is disabled it’ll use different trait bounds to create an
anyhow::Error.
This trait is not suitable as a public interface because features change what implements the trait. It’s good enough for a wasmtime internal implementation detail, however.
Required Methods§
Sourcefn err2anyhow(self) -> Result<T>
fn err2anyhow(self) -> Result<T>
Convert self to anyhow::Result<T>.