DMSCErrorContext

Trait DMSCErrorContext 

Source
pub trait DMSCErrorContext<T, E> {
    // Required methods
    fn chain_context<S>(self, context: S) -> Result<T, DMSCErrorChain>
       where S: Into<String>;
    fn with_chain_context<S, F>(self, f: F) -> Result<T, DMSCErrorChain>
       where S: Into<String>,
             F: FnOnce() -> S;
}
Expand description

Trait for adding error chain functionality to Result types.

Required Methods§

Source

fn chain_context<S>(self, context: S) -> Result<T, DMSCErrorChain>
where S: Into<String>,

Adds context to the error if the Result is Err.

Source

fn with_chain_context<S, F>(self, f: F) -> Result<T, DMSCErrorChain>
where S: Into<String>, F: FnOnce() -> S,

Adds context to the error with lazy evaluation.

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, E> DMSCErrorContext<T, E> for Result<T, E>
where E: StdError + Send + Sync + 'static,

Source§

fn chain_context<S>(self, context: S) -> Result<T, DMSCErrorChain>
where S: Into<String>,

Source§

fn with_chain_context<S, F>(self, f: F) -> Result<T, DMSCErrorChain>
where S: Into<String>, F: FnOnce() -> S,

Implementors§