pub struct RetryConfig {
pub max_retries: usize,
pub initial_delay: Duration,
pub max_delay: Duration,
pub backoff_multiplier: f64,
pub retry_on: RetryOn,
}Expand description
Configuration for retry behavior.
Fields§
§max_retries: usizeMaximum number of retry attempts (not counting the initial call).
initial_delay: DurationInitial delay before the first retry.
max_delay: DurationMaximum delay between retries (caps exponential growth).
backoff_multiplier: f64Multiplier applied to the delay after each attempt. A value of 2.0 means each retry waits twice as long as the previous.
retry_on: RetryOnWhich errors should trigger a retry.
Implementations§
Source§impl RetryConfig
impl RetryConfig
Sourcepub fn new(max_retries: usize) -> Self
pub fn new(max_retries: usize) -> Self
Creates a new RetryConfig with the specified max retries and defaults for other fields.
Sourcepub fn with_initial_delay(self, delay: Duration) -> Self
pub fn with_initial_delay(self, delay: Duration) -> Self
Sets the initial delay.
Sourcepub fn with_max_delay(self, delay: Duration) -> Self
pub fn with_max_delay(self, delay: Duration) -> Self
Sets the maximum delay.
Sourcepub fn with_backoff_multiplier(self, multiplier: f64) -> Self
pub fn with_backoff_multiplier(self, multiplier: f64) -> Self
Sets the backoff multiplier.
Sourcepub fn with_retry_on(self, retry_on: RetryOn) -> Self
pub fn with_retry_on(self, retry_on: RetryOn) -> Self
Sets which errors should trigger a retry.
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 (const: unstable) · 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 !RefUnwindSafe for RetryConfig
impl !UnwindSafe for RetryConfig
impl Freeze for RetryConfig
impl Send for RetryConfig
impl Sync for RetryConfig
impl Unpin for RetryConfig
impl UnsafeUnpin 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