pub trait ConvertOption<T>: 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() -> 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() -> 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() -> C,
C: AnyDebugSendSync + 'static;
}Expand description
Helper on Options for conversion to our Results.
Required Methods§
Sourcefn context<C>(self, context: C) -> Result<T, NeuErr>
fn context<C>(self, context: C) -> Result<T, NeuErr>
Convert None to an error and add human context to the error.
Sourcefn context_with<F, C>(self, context_fn: F) -> Result<T, NeuErr>
fn context_with<F, C>(self, context_fn: F) -> Result<T, NeuErr>
Convert None to an error and 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,
Convert None to an error and 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>where
F: FnOnce() -> C,
C: AnyDebugSendSync + 'static,
fn attach_with<F, C>(self, context_fn: F) -> Result<T, NeuErr>where
F: FnOnce() -> C,
C: AnyDebugSendSync + 'static,
Convert None to an error and 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,
Convert None to an error and 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>where
F: FnOnce() -> C,
C: AnyDebugSendSync + 'static,
fn attach_override_with<F, C>(self, context_fn: F) -> Result<T, NeuErr>where
F: FnOnce() -> C,
C: AnyDebugSendSync + 'static,
Convert None to an error and 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.