pub trait IntervalFunction: Send + Sync {
// Required method
fn next_interval(&self, attempt: usize) -> Duration;
}Expand description
Abstraction for computing retry intervals.
This trait allows for flexible backoff strategies including fixed delays, exponential backoff, randomized backoff, and custom implementations.
Required Methods§
Sourcefn next_interval(&self, attempt: usize) -> Duration
fn next_interval(&self, attempt: usize) -> Duration
Computes the delay before the next retry attempt.
§Arguments
attempt- The retry attempt number (0-indexed, so first retry is 0)
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".