Skip to main content

WithContext

Trait WithContext 

Source
pub trait WithContext<T> {
    // Required methods
    fn with_context<F>(self, f: F) -> Result<T>
       where F: FnOnce() -> ErrorContext;
    fn with_simple_context(self, operation: &str) -> Result<T>;
}
Expand description

Trait for adding context to errors

Required Methods§

Source

fn with_context<F>(self, f: F) -> Result<T>
where F: FnOnce() -> ErrorContext,

Source

fn with_simple_context(self, operation: &str) -> Result<T>

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

Source§

fn with_context<F>(self, f: F) -> Result<T>
where F: FnOnce() -> ErrorContext,

Source§

fn with_simple_context(self, operation: &str) -> Result<T>

Implementors§