pub trait ResultExt<T> {
// Required methods
fn with_context<F>(self, f: F) -> Result<T>
where F: FnOnce() -> String;
fn with_source(self, source: impl Into<String>) -> Result<T>;
fn with_plugin(self, plugin_id: impl Into<String>) -> Result<T>;
fn with_correlation(self, correlation_id: Uuid) -> Result<T>;
}
Expand description
Extension trait for Results to add context
Required Methods§
Sourcefn with_context<F>(self, f: F) -> Result<T>
fn with_context<F>(self, f: F) -> Result<T>
Adds context to an error
Sourcefn with_source(self, source: impl Into<String>) -> Result<T>
fn with_source(self, source: impl Into<String>) -> Result<T>
Sets the error source
Sourcefn with_plugin(self, plugin_id: impl Into<String>) -> Result<T>
fn with_plugin(self, plugin_id: impl Into<String>) -> Result<T>
Sets the plugin ID
Sourcefn with_correlation(self, correlation_id: Uuid) -> Result<T>
fn with_correlation(self, correlation_id: Uuid) -> Result<T>
Sets the correlation ID
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.