pub struct ExponentialBackoff<C> {
pub current_interval: Duration,
pub initial_interval: Duration,
pub randomization_factor: f64,
pub multiplier: f64,
pub max_interval: Duration,
pub start_time: Instant,
pub max_elapsed_time: Option<Duration>,
pub clock: C,
}
Fields§
§current_interval: Duration
The current retry interval.
initial_interval: Duration
The initial retry interval.
randomization_factor: f64
The randomization factor to use for creating a range around the retry interval.
A randomization factor of 0.5 results in a random period ranging between 50% below and 50% above the retry interval.
multiplier: f64
The value to multiply the current interval with for each retry attempt.
max_interval: Duration
The maximum value of the back off period. Once the retry interval reaches this value it stops increasing.
start_time: Instant
The system time. It is calculated when an ExponentialBackoff
instance is
created and is reset when retry
is called.
max_elapsed_time: Option<Duration>
The maximum elapsed time after instantiating ExponentialBackfff
or calling
reset
after which next_backoff
returns None
.
clock: C
The clock used to get the current time.
Implementations§
Source§impl<C: Clock> ExponentialBackoff<C>
impl<C: Clock> ExponentialBackoff<C>
Sourcepub fn get_elapsed_time(&self) -> Duration
pub fn get_elapsed_time(&self) -> Duration
Returns the elapsed time since start_time.
Trait Implementations§
Source§impl<C> Backoff for ExponentialBackoff<C>where
C: Clock,
impl<C> Backoff for ExponentialBackoff<C>where
C: Clock,
Source§impl<C> Clone for ExponentialBackoff<C>where
C: Clone,
impl<C> Clone for ExponentialBackoff<C>where
C: Clone,
Source§impl<C: Debug> Debug for ExponentialBackoff<C>
impl<C: Debug> Debug for ExponentialBackoff<C>
Auto Trait Implementations§
impl<C> Freeze for ExponentialBackoff<C>where
C: Freeze,
impl<C> RefUnwindSafe for ExponentialBackoff<C>where
C: RefUnwindSafe,
impl<C> Send for ExponentialBackoff<C>where
C: Send,
impl<C> Sync for ExponentialBackoff<C>where
C: Sync,
impl<C> Unpin for ExponentialBackoff<C>where
C: Unpin,
impl<C> UnwindSafe for ExponentialBackoff<C>where
C: UnwindSafe,
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