pub trait WithError {
// Required method
fn with_error<T>(operation: impl FnOnce() -> T) -> Result<T, Error>;
}
Available on crate features
internal-api-crypto
and internal-with-error
only.Expand description
Adds error support to operations with an infallible signature.
Required Methods§
Sourcefn with_error<T>(operation: impl FnOnce() -> T) -> Result<T, Error>
fn with_error<T>(operation: impl FnOnce() -> T) -> Result<T, Error>
Executes a seemingly infallible operation with error support.
The closure may actually call multiple seemingly infaillible operations. Each such call should support running after a previous one failed. This funtion returns an error if any such call failed.
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.