diff --git a/src/context.rs b/src/context.rs index 8860193..289d3af 100644 --- a/src/context.rs +++ b/src/context.rs @@ -218,6 +218,13 @@ where } } +impl IntoContext for Arc { + #[inline] + fn into_context(self) -> Context { + Context::new(Detail::Error(PrivateError(self))) + } +} + impl IntoContext for F where C: IntoContext, diff --git a/src/explain.rs b/src/explain.rs index 691d47a..894a090 100644 --- a/src/explain.rs +++ b/src/explain.rs @@ -77,6 +77,16 @@ where } } +impl Explain for Arc { + type Output = How; + + #[track_caller] + fn context(self, context: impl IntoContext) -> Self::Output { + How::new(self.into_context()) + .context(context) + } +} + impl Explain for Option { type Output = Result;