pub enum BackoffStrategy {
Constant(Duration),
Linear {
base: Duration,
},
Exponential {
base: Duration,
max: Duration,
},
Fibonacci {
base: Duration,
},
}Expand description
Backoff strategy for retry delays.
Variants§
Constant(Duration)
Constant delay between retries.
Linear
Linearly increasing delay: base * attempt.
Exponential
Exponentially increasing delay: base * 2^attempt, capped at max.
Fibonacci
Fibonacci-sequence based delay: fib(attempt) * base.
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 the delay for a given attempt number (0-indexed).
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 (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 BackoffStrategy
impl Debug for BackoffStrategy
Source§impl PartialEq for BackoffStrategy
impl PartialEq for BackoffStrategy
impl StructuralPartialEq 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 UnsafeUnpin 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