pub trait OkOrErr<T> {
// Required methods
fn ok_or_internal_err(self, reason: &'static str) -> Result<T>;
fn ok_or_err(
self,
code: impl ErrorInfo + Send + Sync + 'static,
) -> Result<T>;
fn ok_or_err_with(
self,
code: impl ErrorInfo + Send + Sync + 'static,
reason: &'static str,
) -> Result<T>;
}
Expand description
Utility trait to map any Option<T>
to a Result<T, Box<Error>>
Required Methods§
Sourcefn ok_or_internal_err(self, reason: &'static str) -> Result<T>
fn ok_or_internal_err(self, reason: &'static str) -> Result<T>
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.