Trait WaitStrategy
pub trait WaitStrategy {
// Required methods
fn reset(&mut self);
fn wait(&mut self);
}Expand description
Progressive backoff when polling.
This trait is intentionally minimal and no_std-friendly.
It is typically used at the edges (router loops, receive loops) to avoid busy-spinning.
§Contract
- Implementations should be cheap and panic-free.
waitmay spin, yield, or sleep depending on the strategy.- Callers should treat
waitas a hint; it does not guarantee that the observed condition will change.
Required Methods§
fn reset(&mut self)
fn reset(&mut self)
Reset internal counters to the initial (most aggressive) state.
fn wait(&mut self)
fn wait(&mut self)
Perform one backoff step (spin/yield/sleep depending on implementation).
Implementors§
impl WaitStrategy for SpinWait
impl WaitStrategy for StdBackoff
Available on crate feature
std only.impl WaitStrategy for YieldWait
Available on crate feature
std only.