pub trait ProblemResultExt: ResultExt {
// Required methods
fn catch_err<E>(self) -> Result<Result<Self::Value, E>>
where E: Error + Send + Sync + 'static;
fn optional(self) -> Result<Option<Self::Value>>;
}Expand description
Extension methods on Result<T, Problem>.
Required Methods§
Sourcefn catch_err<E>(self) -> Result<Result<Self::Value, E>>
fn catch_err<E>(self) -> Result<Result<Self::Value, E>>
Catch a specific error type E.
Returns Ok(Ok(_)) when the source Result<T> is a T, returns
Ok(Err(_)) when its is a Problem that can downcast to an E,
and returns Err(_) otherwise.
Useful when there is a need to handle a specific error differently,
e.g. a NotFound error.
§Errors
Returns Err if self contains a Problem which is not an E.
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.