n0_snafu

Trait ResultExt

Source
pub trait ResultExt<T> {
    // Required methods
    fn context<C>(self, context: C) -> Result<T, Error>
       where C: AsRef<str>;
    fn with_context<F>(self, context: F) -> Result<T, Error>
       where F: FnOnce() -> String;
    fn e(self) -> Result<T, Error>;
}

Required Methods§

Source

fn context<C>(self, context: C) -> Result<T, Error>
where C: AsRef<str>,

Source

fn with_context<F>(self, context: F) -> Result<T, Error>
where F: FnOnce() -> String,

Source

fn e(self) -> Result<T, Error>

Quickly convert a std error into a Error, without having to write a context message.

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> ResultExt<T> for Option<T>

Source§

fn context<C>(self, context: C) -> Result<T, Error>
where C: AsRef<str>,

Source§

fn e(self) -> Result<T, Error>

Source§

fn with_context<F>(self, context: F) -> Result<T, Error>
where F: FnOnce() -> String,

Implementors§

Source§

impl<T> ResultExt<T> for Result<T, Error>

Source§

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