pub trait DMSCOptionErrorContext<T> {
// Required methods
fn ok_or_chain<E>(self, err: E) -> Result<T, DMSCErrorChain>
where E: StdError + Send + Sync + 'static;
fn ok_or_else_chain<E, F>(self, f: F) -> Result<T, DMSCErrorChain>
where E: StdError + Send + Sync + 'static,
F: FnOnce() -> E;
}Expand description
Extension trait for adding error context to Option types.
Required Methods§
Sourcefn ok_or_chain<E>(self, err: E) -> Result<T, DMSCErrorChain>
fn ok_or_chain<E>(self, err: E) -> Result<T, DMSCErrorChain>
Converts None to an error with context.
Sourcefn ok_or_else_chain<E, F>(self, f: F) -> Result<T, DMSCErrorChain>
fn ok_or_else_chain<E, F>(self, f: F) -> Result<T, DMSCErrorChain>
Converts None to an error with lazy context.
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.