TestScheduler
struct · ferroui-reactive-testing · v0.5.0
struct TestScheduler
A virtual-time scheduler for tests, whose clock counts ticks (TestScheduler). It dereferences to
the virtual-time scheduler (clock, start, advance_to, advance_by, sleep,
schedule_absolute, ...).
Members
newschedulerschedule_absolute_actionstart_withstart_disposedstartruncreate_hot_observablecreate_cold_observablecreate_observer
new
fn new() -> Self
A scheduler with its clock at zero.
scheduler
fn scheduler(self: &Self) -> Rc<dyn IScheduler>
The scheduler as the handle operators take.
schedule_absolute_action
fn schedule_absolute_action(self: &Self, due_time: i64, action: impl FnOnce() -> () + 'static) -> Rc<dyn IDisposable>
Schedules an action at an absolute virtual time.
start_with
fn start_with<T: Clone + 'static>(self: &Self, create: impl FnOnce() -> Rc<dyn IObservable<T>> + 'static, created: i64, subscribed: i64, disposed: i64) -> Rc<MockObserver<T>>
Creates the sequence at created, subscribes an observer at subscribed and disposes the
subscription at disposed, runs the scheduler, and returns the observer with what it
recorded (Start(Func<IObservable<T>>, long, long, long)).
start_disposed
fn start_disposed<T: Clone + 'static>(self: &Self, create: impl FnOnce() -> Rc<dyn IObservable<T>> + 'static, disposed: i64) -> Rc<MockObserver<T>>
start_with at the default times, created at 100, subscribed at 200 and
disposed at disposed (Start(Func<IObservable<T>>, long)).
start
fn start<T: Clone + 'static>(self: &Self, create: impl FnOnce() -> Rc<dyn IObservable<T>> + 'static) -> Rc<MockObserver<T>>
start_with at the default times: created at 100, subscribed at 200,
disposed at 1000 (Start(Func<IObservable<T>>)).
run
fn run(self: &Self)
Runs the queued work (VirtualTimeScheduler.Start()).
create_hot_observable
fn create_hot_observable<T: Clone + 'static>(self: &Self, messages: Vec<Recorded<Notification<T>>>) -> Rc<HotObservable<T>>
A sequence that notifies its messages at their absolute times to the observers subscribed
then (CreateHotObservable).
create_cold_observable
fn create_cold_observable<T: Clone + 'static>(self: &Self, messages: Vec<Recorded<Notification<T>>>) -> Rc<ColdObservable<T>>
A sequence that notifies its messages at their times relative to each subscription
(CreateColdObservable).
create_observer
fn create_observer<T: 'static>(self: &Self) -> Rc<MockObserver<T>>
An observer that records what it receives with the time (CreateObserver).
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>ReceiverAnyToOwnedCloneDefaultDeref
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.