Macro thiserror_context::impl_context

source ·
macro_rules! impl_context {
    ($out:ident($ty:ty)) => { ... };
}
Expand description

Defines a new struct that wraps the error type, allowing additional context to be added.

The wrapped error type is intended to be a thiserror enum, but should work with any error type.

The wrapper will implement all the From methods that the wrapped error type implements.

Ultimately, this allows anyhow-like context and with_context calls on a strongly typed error.

** Example **

impl_context!(DummyError(DummyErrorInner));