PrettyUnwrap

Trait PrettyUnwrap 

Source
pub trait PrettyUnwrap {
    type Inner;

    // Required methods
    fn pretty_unwrap(self) -> Self::Inner;
    fn pretty_expect<S: ToString>(self, context: S) -> Self::Inner;
}
Expand description

A trait to provide a nicer way to unwarp anyhow::Result.

Required Associated Types§

Required Methods§

Source

fn pretty_unwrap(self) -> Self::Inner

Behaves like std::result::Result::unwrap but will print the entire anyhow chain to stderr.

Source

fn pretty_expect<S: ToString>(self, context: S) -> Self::Inner

Behaves like std::result::Result::expect but will print the entire anyhow chain to stderr.

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.

Implementations on Foreign Types§

Source§

impl<T> PrettyUnwrap for Result<T>

Implement the trait for anyhow::Result.

Source§

type Inner = T

Source§

fn pretty_unwrap(self) -> Self::Inner

Source§

fn pretty_expect<S: ToString>(self, context: S) -> Self::Inner

Implementors§