pub trait RetryPolicy: Debug + Send + Sync {
    fn is_expired(&self, duration_since_start: Duration, retry_count: u32) -> bool;
    fn sleep_duration(&self, retry_count: u32) -> Duration;

    fn wait<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _error: &'life1 Error,
        retry_count: u32
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
, { ... } }
Expand description

A retry policy.

In the simple form, the policies need only differ in how they determine if the retry has expired and for how long they should sleep between retries.

wait can be implemented in more complex cases where a simple test of time is not enough.

Required Methods§

Determine if no more retries should be performed.

Must return true if no more retries should be attempted.

Determine how long before the next retry should be attempted.

Provided Methods§

A Future that will wait until the request can be retried. error is the Error value the led to a retry attempt.

Implementors§