pub trait OrErr<T, E> {
// Required methods
fn or_err(self, et: ErrorType, context: &'static str) -> Result<T, BError>
where E: Into<Box<dyn ErrorTrait + Send + Sync>>;
fn or_err_with<C: Into<ImmutStr>, F: FnOnce() -> C>(
self,
et: ErrorType,
context: F,
) -> Result<T, BError>
where E: Into<Box<dyn ErrorTrait + Send + Sync>>;
fn explain_err<C: Into<ImmutStr>, F: FnOnce(E) -> C>(
self,
et: ErrorType,
context: F,
) -> Result<T, BError>;
fn or_fail(self) -> Result<T>
where E: Into<Box<dyn ErrorTrait + Send + Sync>>;
}Expand description
Helper trait to chain errors with context
Required Methods§
Sourcefn or_err_with<C: Into<ImmutStr>, F: FnOnce() -> C>(
self,
et: ErrorType,
context: F,
) -> Result<T, BError>
fn or_err_with<C: Into<ImmutStr>, F: FnOnce() -> C>( self, et: ErrorType, context: F, ) -> Result<T, BError>
Similar to or_err(), but takes a closure, which is useful for constructing String.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".