pub trait RiOptionErrorContext<T> {
// Required methods
fn ok_or_chain<E>(self, err: E) -> Result<T, RiErrorChain>
where E: StdError + Send + Sync + 'static;
fn ok_or_else_chain<E, F>(self, f: F) -> Result<T, RiErrorChain>
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, RiErrorChain>
fn ok_or_chain<E>(self, err: E) -> Result<T, RiErrorChain>
Converts None to an error with context.
Sourcefn ok_or_else_chain<E, F>(self, f: F) -> Result<T, RiErrorChain>
fn ok_or_else_chain<E, F>(self, f: F) -> Result<T, RiErrorChain>
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".