pub struct SpinOptions {
pub timeout: Option<Duration>,
pub only_next: bool,
pub max_callbacks: Option<usize>,
}Expand description
Options controlling blocking spin behavior.
Used with Executor::spin_blocking
to control when the spin loop exits.
Fields§
§timeout: Option<Duration>Stop after this duration.
phase-379 W5 — a Duration, not a u64 of milliseconds. The _ms
suffix was inconsistent with the two methods that consume these options
(Executor::spin_once and Executor::spin already take
core::time::Duration) as well as with rclrs’s SpinOptions::timeout.
Milliseconds ARE the unit the platform ABI’s wait primitives take, but
that conversion belongs at the ABI boundary, where it already happens —
not in the public option a user writes.
only_next: boolOnly process immediately available work (single iteration)
max_callbacks: Option<usize>Stop after processing this many callbacks total
Implementations§
Source§impl SpinOptions
impl SpinOptions
Sourcepub const fn new() -> SpinOptions
pub const fn new() -> SpinOptions
Create default spin options (spin forever until halted)
Sourcepub const fn timeout(self, timeout: Duration) -> SpinOptions
pub const fn timeout(self, timeout: Duration) -> SpinOptions
Set a timeout duration.
Matches rclrs’s SpinOptions::timeout(Duration). Stays const — ours
is a strict superset there, and Duration::from_millis is const-stable
well below this workspace’s MSRV, so SpinOptions::new().timeout( Duration::from_millis(50)) is usable in a const context.
Sourcepub const fn spin_once() -> SpinOptions
pub const fn spin_once() -> SpinOptions
Only process one round of work (equivalent to spin_once)
Sourcepub const fn max_callbacks(self, n: usize) -> SpinOptions
pub const fn max_callbacks(self, n: usize) -> SpinOptions
Stop after processing N callbacks
Trait Implementations§
Source§impl Clone for SpinOptions
impl Clone for SpinOptions
Source§fn clone(&self) -> SpinOptions
fn clone(&self) -> SpinOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more