tryhard::backoff_strategies

Trait BackoffStrategy

source
pub trait BackoffStrategy<'a, E> {
    type Output;

    // Required method
    fn delay(&mut self, attempt: u32, error: &'a E) -> Self::Output;
}
Expand description

Trait for computing the amount of delay between attempts.

Required Associated Types§

source

type Output

The delay type. Will normally be either Duration or RetryPolicy.

Required Methods§

source

fn delay(&mut self, attempt: u32, error: &'a E) -> Self::Output

Compute the amount of delay given the number of attempts so far and the most previous error.

Implementors§