pub struct RetryConfig {
pub max_retries: u32,
pub strategy_type: RetryStrategyType,
pub base_delay_ms: u64,
pub max_delay_ms: u64,
pub retry_on_network_error: bool,
pub retry_on_rate_limit: bool,
pub retry_on_server_error: bool,
pub retry_on_timeout: bool,
pub jitter_factor: f64,
}Expand description
Retry configuration.
Fields§
§max_retries: u32Maximum number of retry attempts.
strategy_type: RetryStrategyTypeType of retry strategy to use.
base_delay_ms: u64Base delay in milliseconds.
max_delay_ms: u64Maximum delay in milliseconds to prevent excessive backoff.
retry_on_network_error: boolWhether to retry on network errors.
retry_on_rate_limit: boolWhether to retry on rate limit errors.
retry_on_server_error: boolWhether to retry on server errors (5xx).
retry_on_timeout: boolWhether to retry on timeout errors.
jitter_factor: f64Jitter factor (0.0-1.0) to add randomness and prevent thundering herd.
Implementations§
Source§impl RetryConfig
impl RetryConfig
Sourcepub fn conservative() -> Self
pub fn conservative() -> Self
Creates a conservative retry configuration with fewer retries and shorter delays.
Sourcepub fn aggressive() -> Self
pub fn aggressive() -> Self
Creates an aggressive retry configuration with more retries and longer delays.
Sourcepub fn rate_limit_only() -> Self
pub fn rate_limit_only() -> Self
Creates a retry configuration for rate limit errors only.
Trait Implementations§
Source§impl Clone for RetryConfig
impl Clone for RetryConfig
Source§fn clone(&self) -> RetryConfig
fn clone(&self) -> RetryConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RetryConfig
impl Debug for RetryConfig
Auto Trait Implementations§
impl Freeze for RetryConfig
impl RefUnwindSafe for RetryConfig
impl Send for RetryConfig
impl Sync for RetryConfig
impl Unpin for RetryConfig
impl UnwindSafe for RetryConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more