pub trait Context<T> {
// Required methods
fn context<C>(self, context: C) -> Result<T, Error>
where C: Display + Debug + Send + Sync + 'static;
fn with_context<C, F>(self, f: F) -> Result<T, Error>
where C: Display + Debug + Send + Sync + 'static,
F: FnOnce() -> C;
fn with_field<V>(self, key: &'static str, value: V) -> Result<T, Error>
where V: Display;
fn with_field_debug<V>(
self,
key: &'static str,
value: V,
) -> Result<T, Error>
where V: Debug;
}Expand description
Extension trait for adding context and fields to errors.
Required Methods§
Sourcefn context<C>(self, context: C) -> Result<T, Error>
fn context<C>(self, context: C) -> Result<T, Error>
Wrap the error value with additional context.
Sourcefn with_context<C, F>(self, f: F) -> Result<T, Error>
fn with_context<C, F>(self, f: F) -> Result<T, Error>
Wrap the error value with additional context that is evaluated lazily.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".