pub trait ResExtensions<T> {
// Required methods
fn extend(self, ext: Arc<dyn Extension>) -> Result<T, ErrorContext>;
fn with_extension(
self,
ext: impl FnOnce() -> Arc<dyn Extension>,
) -> Result<T, ErrorContext>;
fn without_extension<E: Extension>(self) -> Result<T, ErrorContext>;
}
Available on crate feature
extensions
only.Expand description
A helper trait for extending error variants of Result<T, ErrorContext>
Required Methods§
Sourcefn extend(self, ext: Arc<dyn Extension>) -> Result<T, ErrorContext>
fn extend(self, ext: Arc<dyn Extension>) -> Result<T, ErrorContext>
Adds the given extension to the error
Sourcefn with_extension(
self,
ext: impl FnOnce() -> Arc<dyn Extension>,
) -> Result<T, ErrorContext>
fn with_extension( self, ext: impl FnOnce() -> Arc<dyn Extension>, ) -> Result<T, ErrorContext>
Adds a dynamically computed extension to the error
The function is only called if the result is an error variant
Sourcefn without_extension<E: Extension>(self) -> Result<T, ErrorContext>
fn without_extension<E: Extension>(self) -> Result<T, ErrorContext>
Removes any extension of a given type from the error
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.