Struct tokio_retry::strategies::ExponentialBackoff
[−]
[src]
pub struct ExponentialBackoff { /* fields omitted */ }
A retry strategy driven by exponential back-off.
The power corresponds to the number of past attempts.
Methods
impl ExponentialBackoff
[src]
fn from_millis(base: u64) -> ExponentialBackoff
Constructs a new exponential back-off strategy, given a base duration in milliseconds.
The resulting duration is calculated by taking the base to the n
-th power,
where n
denotes the number of past attempts.
Trait Implementations
impl Clone for ExponentialBackoff
[src]
fn clone(&self) -> ExponentialBackoff
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl RetryStrategy for ExponentialBackoff
[src]
fn delay(&mut self) -> Option<Duration>
If Some
is returned, causes a delay of the specified duration before the next attempt. If None
is returned, causes no further attempts. Read more
fn jitter(self) -> Jittered<Self> where Self: Sized
Introduce full random jitter to the delay between attempts.
fn limit_retries(self, max_retries: usize) -> LimitedRetries<Self> where Self: Sized
Limit the number of retries.
fn limit_delay(self, max_delay: Duration) -> LimitedDelay<Self> where Self: Sized
Limit the delay between attempts.
fn run<S, A, F>(self, sleep: S, action: F) -> RetryFuture<S, Self, A, F> where S: Sleep, Self: Sized, A: IntoFuture, F: FnMut() -> A
Run the provided action, and if it fails, retry it using this strategy.