pub trait CtxResultExt: Sized {
// Required methods
fn context<C>(self, context: C) -> Self
where C: Into<Cow<'static, str>>;
fn context_with<F, C>(self, context_fn: F) -> Self
where F: FnOnce() -> C,
C: Into<Cow<'static, str>>;
fn attach<C>(self, context: C) -> Self
where C: AnyDebugSendSync + 'static;
fn attach_with<F, C>(self, context_fn: F) -> Self
where F: FnOnce() -> C,
C: AnyDebugSendSync + 'static;
fn attach_override<C>(self, context: C) -> Self
where C: AnyDebugSendSync + 'static;
fn attach_override_with<F, C>(self, context_fn: F) -> Self
where F: FnOnce() -> C,
C: AnyDebugSendSync + 'static;
}Expand description
Helper on our Results for context addition and modification.
Required Methods§
Sourcefn context_with<F, C>(self, context_fn: F) -> Self
fn context_with<F, C>(self, context_fn: F) -> Self
Add human context to the error via a closure.
Sourcefn attach<C>(self, context: C) -> Selfwhere
C: AnyDebugSendSync + 'static,
fn attach<C>(self, context: C) -> Selfwhere
C: AnyDebugSendSync + 'static,
Add machine context to the error.
This will not override existing attachments. If you want to replace and override any
existing attachments of the same type, use attach_override instead.
Sourcefn attach_with<F, C>(self, context_fn: F) -> Selfwhere
F: FnOnce() -> C,
C: AnyDebugSendSync + 'static,
fn attach_with<F, C>(self, context_fn: F) -> Selfwhere
F: FnOnce() -> C,
C: AnyDebugSendSync + 'static,
Add machine context to the error via a closure.
This will not override existing attachments. If you want to replace and override any
existing attachments of the same type, use attach_override instead.
Sourcefn attach_override<C>(self, context: C) -> Selfwhere
C: AnyDebugSendSync + 'static,
fn attach_override<C>(self, context: C) -> Selfwhere
C: AnyDebugSendSync + 'static,
Set machine context in the error.
This will override existing attachments of the same type. If you want to add attachments of
the same type, use attach instead.
Sourcefn attach_override_with<F, C>(self, context_fn: F) -> Selfwhere
F: FnOnce() -> C,
C: AnyDebugSendSync + 'static,
fn attach_override_with<F, C>(self, context_fn: F) -> Selfwhere
F: FnOnce() -> C,
C: AnyDebugSendSync + 'static,
Set machine context in the error via a closure.
This will override existing attachments of the same type. If you want to add attachments of
the same type, use attach instead.
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.