pub trait ConvertResult<T, E>: Sized {
// Required methods
fn context<C>(self, context: C) -> Result<T, NeuErr>
where C: Into<Cow<'static, str>>;
fn context_with<F, C>(self, context_fn: F) -> Result<T, NeuErr>
where F: FnOnce(&E) -> C,
C: Into<Cow<'static, str>>;
fn attach<C>(self, context: C) -> Result<T, NeuErr>
where C: AnyDebugSendSync + 'static;
fn attach_with<F, C>(self, context_fn: F) -> Result<T, NeuErr>
where F: FnOnce(&E) -> C,
C: AnyDebugSendSync + 'static;
fn attach_override<C>(self, context: C) -> Result<T, NeuErr>
where C: AnyDebugSendSync + 'static;
fn attach_override_with<F, C>(self, context_fn: F) -> Result<T, NeuErr>
where F: FnOnce(&E) -> C,
C: AnyDebugSendSync + 'static;
}Expand description
Helper on Results with external Errors for conversion to our NeuErr.
Required Methods§
Sourcefn context_with<F, C>(self, context_fn: F) -> Result<T, NeuErr>
fn context_with<F, C>(self, context_fn: F) -> Result<T, NeuErr>
Add human context to the error via a closure.
Sourcefn attach<C>(self, context: C) -> Result<T, NeuErr>where
C: AnyDebugSendSync + 'static,
fn attach<C>(self, context: C) -> Result<T, NeuErr>where
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) -> Result<T, NeuErr>
fn attach_with<F, C>(self, context_fn: F) -> Result<T, NeuErr>
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) -> Result<T, NeuErr>where
C: AnyDebugSendSync + 'static,
fn attach_override<C>(self, context: C) -> Result<T, NeuErr>where
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) -> Result<T, NeuErr>
fn attach_override_with<F, C>(self, context_fn: F) -> Result<T, NeuErr>
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.