VirtualTimeScheduler
struct · ferroui-reactive · v0.5.0
struct VirtualTimeScheduler<C: VirtualTimeClock>
A scheduler of virtual time (VirtualTimeScheduler<TAbsolute, TRelative>): work runs when the
clock is advanced to its due time (start, advance_to, advance_by), in the order of due
times and, for equal ones, in the order it was scheduled.
Members
historicalhistorical_atnewclockset_clockis_enabledschedule_absoluteschedule_relativestartstopadvance_toadvance_bysleep
historical
fn historical() -> Rc<Self>
A historical scheduler with its clock at the epoch of the system time.
Deviation (DEVIATIONS.md, Reactive): upstream starts at DateTimeOffset.MinValue; the
system time has no such minimum, and the epoch is the earliest time every platform has.
historical_at
fn historical_at(initial_clock: SystemTime) -> Rc<Self>
A historical scheduler with its clock at initial_clock.
new
fn new(initial_clock: <C as >::Absolute) -> Rc<Self>
A scheduler with its clock at initial_clock.
clock
fn clock(self: &Self) -> <C as >::Absolute
The current time of the clock (Clock).
set_clock
fn set_clock(self: &Self, clock: <C as >::Absolute)
Sets the clock (Clock's protected setter), for derived schedulers.
is_enabled
fn is_enabled(self: &Self) -> bool
Whether the scheduler is running work (IsEnabled).
schedule_absolute
fn schedule_absolute(self: &Self, due_time: <C as >::Absolute, action: ScheduledAction) -> Rc<dyn IDisposable>
Schedules work at an absolute virtual time (ScheduleAbsolute).
schedule_relative
fn schedule_relative(self: &Self, due_time: <C as >::Relative, action: ScheduledAction) -> Rc<dyn IDisposable>
Schedules work at a virtual time relative to the clock (ScheduleRelative).
start
fn start(self: &Self)
Runs the queued work, moving the clock to the due time of each, until there is none or the
scheduler is stopped (Start).
stop
fn stop(self: &Self)
Stops the scheduler after the work that runs (Stop).
advance_to
fn advance_to(self: &Self, time: <C as >::Absolute)
Runs the work due up to time and moves the clock to it (AdvanceTo). Panics when time
is before the clock or the scheduler is running, where upstream throws.
advance_by
fn advance_by(self: &Self, time: <C as >::Relative)
Runs the work due within time from the clock and moves the clock by it (AdvanceBy).
sleep
fn sleep(self: &Self, time: <C as >::Relative)
Moves the clock by time without running work (Sleep).
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyISchedulerIStopwatchProvider
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.