pub struct SimScheduler { /* private fields */ }Expand description
Single-threaded deterministic event scheduler.
Events are processed in (tick, id) order. Within the same tick, events
are delivered in FIFO insertion order. No wall-clock access, no OS threads.
Implementations§
Source§impl SimScheduler
impl SimScheduler
Sourcepub fn schedule_at(&mut self, tick: u64, kind: SimEventKind) -> u64
pub fn schedule_at(&mut self, tick: u64, kind: SimEventKind) -> u64
Schedule an event at a specific tick. Returns the event ID.
Sourcepub fn schedule_after(&mut self, delay: u64, kind: SimEventKind) -> u64
pub fn schedule_after(&mut self, delay: u64, kind: SimEventKind) -> u64
Schedule an event relative to the current tick.
Sourcepub fn run_until(&mut self, max_tick: u64) -> Vec<SimEvent>
pub fn run_until(&mut self, max_tick: u64) -> Vec<SimEvent>
Process all events up to and including the given tick.
Sourcepub fn current_tick(&self) -> u64
pub fn current_tick(&self) -> u64
Current simulation tick.
Sourcepub fn advance_to(&mut self, tick: u64)
pub fn advance_to(&mut self, tick: u64)
Advance the current tick without processing events.
Sourcepub fn pending_count(&self) -> usize
pub fn pending_count(&self) -> usize
Number of pending events.
Sourcepub fn events_processed(&self) -> u64
pub fn events_processed(&self) -> u64
Total events processed so far.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SimScheduler
impl RefUnwindSafe for SimScheduler
impl Send for SimScheduler
impl Sync for SimScheduler
impl Unpin for SimScheduler
impl UnsafeUnpin for SimScheduler
impl UnwindSafe for SimScheduler
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