Trait retry_future::RetryStrategy
source · pub trait RetryStrategy {
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.