Trait thisctx::WithContext

source ·
pub trait WithContext: Sized {
    type Ok;
    type Err;

    // Required method
    fn context_with<E, C>(self, f: impl FnOnce() -> C) -> Result<Self::Ok, E>
       where C: IntoError<E>,
             Self::Err: Into<C::Source>;

    // Provided method
    fn context<E, C>(self, context: C) -> Result<Self::Ok, E>
       where C: IntoError<E>,
             Self::Err: Into<C::Source> { ... }
}

Required Associated Types§

Required Methods§

source

fn context_with<E, C>(self, f: impl FnOnce() -> C) -> Result<Self::Ok, E>where C: IntoError<E>, Self::Err: Into<C::Source>,

Provided Methods§

source

fn context<E, C>(self, context: C) -> Result<Self::Ok, E>where C: IntoError<E>, Self::Err: Into<C::Source>,

Implementations on Foreign Types§

source§

impl<T> WithContext for Option<T>

§

type Ok = T

§

type Err = NoneSource

source§

fn context_with<E, C>(self, f: impl FnOnce() -> C) -> Result<T, E>where C: IntoError<E>, NoneSource: Into<C::Source>,

source§

impl<T, Err> WithContext for Result<T, Err>

§

type Ok = T

§

type Err = Err

source§

fn context_with<E, C>(self, f: impl FnOnce() -> C) -> Result<T, E>where C: IntoError<E>, Err: Into<C::Source>,

Implementors§