Skip to main content

Backoff

Trait Backoff 

Source
pub trait Backoff: Send + Sync {
    // Required methods
    fn delay(&self, attempt: u32) -> Duration;
    fn max_delay(&self) -> Duration;
}
Expand description

Trait for backoff strategies.

Required Methods§

Source

fn delay(&self, attempt: u32) -> Duration

Calculates the delay for the given attempt number (0-based).

Source

fn max_delay(&self) -> Duration

Returns the maximum delay this backoff will produce.

Implementors§