Skip to main content

Sleeper

Trait Sleeper 

Source
pub trait Sleeper:
    Clone
    + Send
    + Sync {
    // Required method
    fn sleep(&self, dur: Duration) -> impl Future<Output = ()> + Send;
}
Expand description

How a retry/stall loop performs its backoff wait. Abstracted so the wait is real in production (TokioSleeper) but a deterministic no-op in tests — the stall-cut-resume smoke asserts zero duplicate bytes with no wall-clock sleep.

Required Methods§

Source

fn sleep(&self, dur: Duration) -> impl Future<Output = ()> + Send

Wait for dur.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§