Trait Backoff

Source
pub trait Backoff:
    Send
    + Sync
    + 'static {
    // Required methods
    fn next_delay(&self, attempt: usize) -> Duration;
    fn box_clone(&self) -> Box<dyn Backoff>;

    // Provided method
    fn reset(&mut self) { ... }
}
Expand description

Trait for backoff strategies used in retry mechanisms

Required Methods§

Source

fn next_delay(&self, attempt: usize) -> Duration

Get the next delay duration based on the current attempt

Source

fn box_clone(&self) -> Box<dyn Backoff>

Create a clone of this backoff strategy

Provided Methods§

Source

fn reset(&mut self)

Reset the backoff state

Trait Implementations§

Source§

impl Backoff for Box<dyn Backoff>

Source§

fn next_delay(&self, attempt: usize) -> Duration

Get the next delay duration based on the current attempt
Source§

fn reset(&mut self)

Reset the backoff state
Source§

fn box_clone(&self) -> Box<dyn Backoff>

Create a clone of this backoff strategy

Implementations on Foreign Types§

Source§

impl Backoff for Box<dyn Backoff>

Source§

fn next_delay(&self, attempt: usize) -> Duration

Source§

fn reset(&mut self)

Source§

fn box_clone(&self) -> Box<dyn Backoff>

Implementors§