Trait ForgeErrorRecovery

Source
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§

Source

fn create_retry_policy(&self, max_retries: usize) -> RetryPolicy

Create a retry policy optimized for this error type

Source

fn retry<F, T, E>(&self, max_retries: usize, operation: F) -> Result<T, E>
where F: FnMut() -> Result<T, E>, E: ForgeError,

Execute a fallible operation with retries if this error type is retryable

Source

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.

Implementors§