pub enum WaitStrategy {
BusySpin,
YieldSpin,
BackoffSpin,
Adaptive {
spin_iters: u32,
yield_iters: u32,
},
}Expand description
Strategy for blocking recv() and SubscriberGroup::recv().
All variants are no_std compatible — no OS thread primitives required.
| Strategy | Latency | CPU usage | Best for |
|---|---|---|---|
BusySpin | Lowest (~0 ns wakeup) | 100% core | Dedicated, pinned cores |
YieldSpin | Low (~30 ns on x86) | High | Shared cores, SMT |
BackoffSpin | Medium (exponential) | Decreasing | Background consumers |
Adaptive | Auto-scaling | Varies | General purpose |
Variants§
BusySpin
Pure busy-spin with no PAUSE instruction. Minimum wakeup latency but consumes 100% of one CPU core. Use on dedicated, pinned cores.
YieldSpin
Spin with core::hint::spin_loop() (PAUSE on x86, YIELD on ARM)
between iterations. Yields the CPU pipeline to the SMT sibling
and reduces power consumption vs BusySpin.
BackoffSpin
Exponential backoff spin. Starts with bare spins, then escalates to PAUSE-based spins with increasing delays. Good for consumers that may be idle for extended periods without burning a full core.
Adaptive
Three-phase escalation: bare spin for spin_iters iterations,
then PAUSE-spin for yield_iters, then repeated PAUSE bursts.
Trait Implementations§
Source§impl Clone for WaitStrategy
impl Clone for WaitStrategy
Source§fn clone(&self) -> WaitStrategy
fn clone(&self) -> WaitStrategy
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for WaitStrategy
impl Debug for WaitStrategy
Source§impl Default for WaitStrategy
impl Default for WaitStrategy
Source§impl PartialEq for WaitStrategy
impl PartialEq for WaitStrategy
impl Copy for WaitStrategy
impl Eq for WaitStrategy
impl StructuralPartialEq for WaitStrategy
Auto Trait Implementations§
impl Freeze for WaitStrategy
impl RefUnwindSafe for WaitStrategy
impl Send for WaitStrategy
impl Sync for WaitStrategy
impl Unpin for WaitStrategy
impl UnsafeUnpin for WaitStrategy
impl UnwindSafe for WaitStrategy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.