pub struct DcpsTickDriver { /* private fields */ }Expand description
Drives a runtime’s periodic tick from an external executor (tokio, an
embedded scheduler, a manual test loop). Obtained via
DcpsRuntime::tick_driver; only does useful work when the runtime was
started with RuntimeConfig::external_tick = true.
Typical loop (the async crate’s spawn_in_tokio shape):
ⓘ
let mut driver = runtime.tick_driver();
let period = driver.tick_period();
while !driver.is_stopped() {
driver.tick();
tokio::time::sleep(period).await;
}Implementations§
Source§impl DcpsTickDriver
impl DcpsTickDriver
Sourcepub fn tick_period(&self) -> Duration
pub fn tick_period(&self) -> Duration
Period the caller should wait between consecutive Self::tick calls
(mirrors the internal zdds-tick thread’s tick_period).
Sourcepub fn is_stopped(&self) -> bool
pub fn is_stopped(&self) -> bool
true once the runtime is shutting down (set by Drop/stop()). The
driving task must then stop calling Self::tick and return so the
runtime can be dropped cleanly.
Auto Trait Implementations§
impl !RefUnwindSafe for DcpsTickDriver
impl !UnwindSafe for DcpsTickDriver
impl Freeze for DcpsTickDriver
impl Send for DcpsTickDriver
impl Sync for DcpsTickDriver
impl Unpin for DcpsTickDriver
impl UnsafeUnpin for DcpsTickDriver
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