pub enum BackoffStrategy {
Constant(Duration),
Linear {
base: Duration,
increment: Duration,
},
Exponential {
base: Duration,
max: Duration,
},
Custom(CustomBackoff),
}Expand description
Backoff strategy for retries
Variants§
Constant(Duration)
Constant time between retries
Linear
Linear increase in time between retries
Exponential
Exponential increase in time between retries (base * 2^attempt)
Custom(CustomBackoff)
Custom backoff strategy implemented as a function
Implementations§
Source§impl BackoffStrategy
impl BackoffStrategy
Sourcepub fn calculate_delay(&self, attempt: usize) -> Duration
pub fn calculate_delay(&self, attempt: usize) -> Duration
Calculate the delay for a given attempt
Trait Implementations§
Source§impl Clone for BackoffStrategy
impl Clone for BackoffStrategy
Source§fn clone(&self) -> BackoffStrategy
fn clone(&self) -> BackoffStrategy
Returns a copy 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 moreAuto Trait Implementations§
impl Freeze for BackoffStrategy
impl !RefUnwindSafe for BackoffStrategy
impl Send for BackoffStrategy
impl Sync for BackoffStrategy
impl Unpin for BackoffStrategy
impl !UnwindSafe for BackoffStrategy
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