pub enum RetryStrategy {
NoRetry,
Immediate {
max_attempts: u32,
},
FixedDelay {
delay: Duration,
max_attempts: u32,
},
ExponentialBackoff {
base: Duration,
max_attempts: u32,
},
}Expand description
Retry strategy for transient errors
Variants§
NoRetry
Do not retry.
Immediate
Retry immediately up to a maximum number of attempts.
FixedDelay
Retry with a fixed delay between attempts.
ExponentialBackoff
Retry with exponential backoff.
Implementations§
Source§impl RetryStrategy
impl RetryStrategy
Sourcepub fn delay_for_attempt(&self, attempt: u32) -> Option<Duration>
pub fn delay_for_attempt(&self, attempt: u32) -> Option<Duration>
Compute the delay for a given retry attempt, or None if exhausted.
Sourcepub fn max_attempts(&self) -> u32
pub fn max_attempts(&self) -> u32
Return the maximum number of retry attempts.
Trait Implementations§
Source§impl Clone for RetryStrategy
impl Clone for RetryStrategy
Source§fn clone(&self) -> RetryStrategy
fn clone(&self) -> RetryStrategy
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 RetryStrategy
impl Debug for RetryStrategy
Source§impl Default for RetryStrategy
impl Default for RetryStrategy
Source§impl PartialEq for RetryStrategy
impl PartialEq for RetryStrategy
impl StructuralPartialEq for RetryStrategy
Auto Trait Implementations§
impl Freeze for RetryStrategy
impl RefUnwindSafe for RetryStrategy
impl Send for RetryStrategy
impl Sync for RetryStrategy
impl Unpin for RetryStrategy
impl UnsafeUnpin for RetryStrategy
impl UnwindSafe for RetryStrategy
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