pub trait ResultExt {
type Success;
type Error: ErrorBound;
// Required methods
fn or_attach<A, F>(self, context: F) -> Result<Self::Success, Self::Error>
where A: ContextBound,
F: FnOnce() -> A;
fn or_raise<A, F>(self, err: F) -> Result<Self::Success, A>
where A: ErrorBound,
F: FnOnce() -> A;
}Required Associated Types§
Sourcetype Error: ErrorBound
type Error: ErrorBound
The Err type that would be wrapped in an Exn.
Required Methods§
Sourcefn or_attach<A, F>(self, context: F) -> Result<Self::Success, Self::Error>where
A: ContextBound,
F: FnOnce() -> A,
fn or_attach<A, F>(self, context: F) -> Result<Self::Success, Self::Error>where
A: ContextBound,
F: FnOnce() -> A,
Attach a new context to the Exn inside the Result.
Applies Exn::attach on the Err variant, refer to it for more information.
Sourcefn or_raise<A, F>(self, err: F) -> Result<Self::Success, A>where
A: ErrorBound,
F: FnOnce() -> A,
fn or_raise<A, F>(self, err: F) -> Result<Self::Success, A>where
A: ErrorBound,
F: FnOnce() -> A,
Raise a new exception on the Exn inside the Result.
Applies Exn::raise on the Err variant, refer to it for more information.
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.