pub enum BackoffStrategy {
None,
Fixed {
delay: Duration,
},
Linear {
base: Duration,
max: Duration,
},
Exponential {
base: Duration,
multiplier: f64,
max: Duration,
},
}Expand description
Backoff strategy for computing delay between retry attempts.
Variants§
None
No delay between retries.
Fixed
Fixed delay between all retries.
Linear
Linear backoff: delay = base * attempt, capped at max.
Exponential
Exponential backoff: delay = base * multiplier^(attempt-1), capped at max.
Implementations§
Source§impl BackoffStrategy
impl BackoffStrategy
Sourcepub fn delay_for_attempt(&self, attempt: u32) -> Duration
pub fn delay_for_attempt(&self, attempt: u32) -> Duration
Compute delay for given attempt (1-indexed). Attempt 1 is after first failure, so delay_for_attempt(1) is the first backoff.
Trait Implementations§
Source§impl Clone for BackoffStrategy
impl Clone for BackoffStrategy
Source§fn clone(&self) -> BackoffStrategy
fn clone(&self) -> BackoffStrategy
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BackoffStrategy
impl Debug for BackoffStrategy
Auto 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§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)