pub trait Context<T> {
    // Required method
    fn err_context<C: Into<ImmutStr>, F: FnOnce() -> C>(
        self,
        context: F
    ) -> Result<T, BError>;
}
Expand description

Helper trait to add more context to a given error

Required Methods§

source

fn err_context<C: Into<ImmutStr>, F: FnOnce() -> C>( self, context: F ) -> Result<T, BError>

Wrap the Err(E) in Result with more context, the existing E will be the cause.

This is a shortcut for map_err() + more_context()

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T> Context<T> for Result<T, BError>