Trait pingora_core::OrErr
source · pub trait OrErr<T, E> {
// Required methods
fn or_err(
self,
et: ErrorType,
context: &'static str
) -> Result<T, Box<Error>>
where E: Into<Box<dyn Error + Sync + Send>>;
fn or_err_with<C, F>(
self,
et: ErrorType,
context: F
) -> Result<T, Box<Error>>
where C: Into<ImmutStr>,
F: FnOnce() -> C,
E: Into<Box<dyn Error + Sync + Send>>;
fn explain_err<C, F>(
self,
et: ErrorType,
context: F
) -> Result<T, Box<Error>>
where C: Into<ImmutStr>,
F: FnOnce(E) -> C;
}
Expand description
Helper trait to chain errors with context
Required Methods§
sourcefn or_err_with<C, F>(self, et: ErrorType, context: F) -> Result<T, Box<Error>>
fn or_err_with<C, F>(self, et: ErrorType, context: F) -> Result<T, Box<Error>>
Similar to or_err(), but takes a closure, which is useful for constructing String.
Object Safety§
This trait is not object safe.