thiserror_context

Trait Context

Source
pub trait Context<W, T, E>
where E: Into<W>,
{ // Required methods fn context<C>(self, context: C) -> Result<T, W> where C: Display + Send + Sync + 'static; fn with_context<C, F>(self, f: F) -> Result<T, W> where C: Display + Send + Sync + 'static, F: FnOnce() -> C; }

Required Methods§

Source

fn context<C>(self, context: C) -> Result<T, W>
where C: Display + Send + Sync + 'static,

Wrap the error value with additional context.

Source

fn with_context<C, F>(self, f: F) -> Result<T, W>
where C: Display + Send + Sync + 'static, F: FnOnce() -> C,

Wrap the error value with additional context that is evaluated lazily only once an error does occur.

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.

Implementors§