Skip to main content

ErrorContext

Trait ErrorContext 

Source
pub trait ErrorContext<T> {
    // Required methods
    fn error<M: Into<Cow<'static, str>>>(self, message: M) -> Result<T>;
    fn or_error<M: Into<Cow<'static, str>>, F: FnOnce() -> M>(
        self,
        f: F,
    ) -> Result<T>;
}

Required Methods§

Source

fn error<M: Into<Cow<'static, str>>>(self, message: M) -> Result<T>

Source

fn or_error<M: Into<Cow<'static, str>>, F: FnOnce() -> M>( self, f: F, ) -> Result<T>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T> ErrorContext<T> for Option<T>

Source§

fn error<M: Into<Cow<'static, str>>>(self, message: M) -> Result<T>

Source§

fn or_error<M: Into<Cow<'static, str>>, F: FnOnce() -> M>( self, f: F, ) -> Result<T>

Implementors§

Source§

impl<T, E: StdError + Send + Sync + 'static> ErrorContext<T> for Result<T, E>