pub trait ForgeErrorRecovery: ForgeError {
// Provided methods
fn create_retry_policy(&self, max_retries: usize) -> RetryPolicy { ... }
fn retry<F, T, E>(&self, max_retries: usize, operation: F) -> Result<T, E>
where F: FnMut() -> Result<T, E>,
E: ForgeError { ... }
fn create_circuit_breaker(&self, name: impl Into<String>) -> CircuitBreaker { ... }
}
Expand description
Extension trait that adds recovery capabilities to ForgeError types
Provided Methods§
Sourcefn create_retry_policy(&self, max_retries: usize) -> RetryPolicy
fn create_retry_policy(&self, max_retries: usize) -> RetryPolicy
Create a retry policy optimized for this error type
Sourcefn retry<F, T, E>(&self, max_retries: usize, operation: F) -> Result<T, E>
fn retry<F, T, E>(&self, max_retries: usize, operation: F) -> Result<T, E>
Execute a fallible operation with retries if this error type is retryable
Sourcefn create_circuit_breaker(&self, name: impl Into<String>) -> CircuitBreaker
fn create_circuit_breaker(&self, name: impl Into<String>) -> CircuitBreaker
Create a circuit breaker for operations that might result in this error type
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.