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§
Sourcefn check_attempt(
&mut self,
attempts_before: usize,
) -> Result<Duration, TooManyAttempts>
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(_).
Sourcefn retry_early_returned_errors(&self) -> bool
fn retry_early_returned_errors(&self) -> bool
If true, errors propagated using ? inside a future
will be retried.