RetryStrategy

Trait RetryStrategy 

Source
pub trait RetryStrategy {
    // Required methods
    fn check_attempt(
        &mut self,
        attempts_before: usize,
    ) -> Result<Duration, TooManyAttempts>;
    fn retry_early_returned_errors(&self) -> bool;
}
Expand description

Configuration trait for RetryFuture.

Goal of the trait is to return either a duration which means how long a future needs to sleep before trying to resolve again or an error if there were already too many attempts.

Required Methods§

Source

fn check_attempt( &mut self, attempts_before: usize, ) -> Result<Duration, TooManyAttempts>

attempts_before means how many attempts a future was trying to resolve to Ok(_) after returning Err(_).

Source

fn retry_early_returned_errors(&self) -> bool

If true, errors propagated using ? inside a future will be retried.

Implementations on Foreign Types§

Source§

impl<T> RetryStrategy for &mut T
where T: RetryStrategy,

Implementors§