pub struct RetryConfig {
pub max_attempts: usize,
pub backoff: BackoffStrategy,
pub jitter: bool,
}Available on crate feature
retry only.Expand description
Configuration for retry behavior.
Fields§
§max_attempts: usizeMaximum number of attempts (including first try).
backoff: BackoffStrategyBackoff strategy between attempts.
jitter: boolWhether to add jitter to delays.
Implementations§
Source§impl RetryConfig
impl RetryConfig
Sourcepub const fn max_attempts(self, n: usize) -> Self
pub const fn max_attempts(self, n: usize) -> Self
Set maximum number of attempts.
Sourcepub const fn backoff(self, strategy: BackoffStrategy) -> Self
pub const fn backoff(self, strategy: BackoffStrategy) -> Self
Set backoff strategy.
Sourcepub const fn with_constant_delay(attempts: usize, delay: Duration) -> Self
pub const fn with_constant_delay(attempts: usize, delay: Duration) -> Self
Create config with simple constant delay.
Sourcepub const fn with_exponential_backoff(
attempts: usize,
initial: Duration,
max: Duration,
) -> Self
pub const fn with_exponential_backoff( attempts: usize, initial: Duration, max: Duration, ) -> Self
Create config with exponential backoff.
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
Source§impl Default for RetryConfig
impl Default for RetryConfig
impl Copy 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 UnsafeUnpin 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