pub trait ResultExt<T> {
// Required methods
fn context(self, ctx: impl Into<String>) -> ChieResult<T>;
fn with_context<F>(self, f: F) -> ChieResult<T>
where F: FnOnce() -> String;
}Expand description
Extension trait to add context to any result
Required Methods§
Sourcefn context(self, ctx: impl Into<String>) -> ChieResult<T>
fn context(self, ctx: impl Into<String>) -> ChieResult<T>
Sourcefn with_context<F>(self, f: F) -> ChieResult<T>
fn with_context<F>(self, f: F) -> ChieResult<T>
Add context using a closure (lazy evaluation)
§Errors
Returns the error with additional context if the result is 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.