pub trait ResultExt<T> {
// Required methods
fn context<S: ToString>(self, ctx: S) -> Result<T>;
fn with_context<S: ToString, F: FnOnce() -> S>(self, ctx_fn: F) -> Result<T>;
}Expand description
Extension methods to the Result type.
Required Methods§
Sourcefn with_context<S: ToString, F: FnOnce() -> S>(self, ctx_fn: F) -> Result<T>
fn with_context<S: ToString, F: FnOnce() -> S>(self, ctx_fn: F) -> Result<T>
Adds context to the error, evaluating the context function only if there
is an Err.
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.