VirtualTimeScheduler

open class VirtualTimeScheduler<Converter: VirtualTimeConverterType>
    : SchedulerType
extension VirtualTimeScheduler: CustomDebugStringConvertible

Base class for virtual time schedulers using a priority queue for scheduled items.

  • Undocumented

    Declaration

    Swift

    public typealias VirtualTime = Converter.VirtualTimeUnit
  • Undocumented

    Declaration

    Swift

    public typealias VirtualTimeInterval = Converter.VirtualTimeIntervalUnit
  • now

    Declaration

    Swift

    public var now: RxTime { get }

    Return Value

    Current time.

  • Declaration

    Swift

    public var clock: VirtualTime { get }

    Return Value

    Scheduler’s absolute time clock value.

  • Creates a new virtual time scheduler.

    Declaration

    Swift

    public init(initialClock: VirtualTime, converter: Converter)

    Parameters

    initialClock

    Initial value for the clock.

  • Schedules an action to be executed immediately.

    Declaration

    Swift

    public func schedule<StateType>(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable

    Parameters

    state

    State passed to the action to be executed.

    action

    Action to be executed.

    Return Value

    The disposable object used to cancel the scheduled action (best effort).

  • Schedules an action to be executed.

    Declaration

    Swift

    public func scheduleRelative<StateType>(_ state: StateType, dueTime: RxTimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable

    Parameters

    state

    State passed to the action to be executed.

    dueTime

    Relative time after which to execute the action.

    action

    Action to be executed.

    Return Value

    The disposable object used to cancel the scheduled action (best effort).

  • Schedules an action to be executed after relative time has passed.

    Declaration

    Swift

    public func scheduleRelativeVirtual<StateType>(_ state: StateType, dueTime: VirtualTimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable

    Parameters

    state

    State passed to the action to be executed.

    time

    Absolute time when to execute the action. If this is less or equal then now, now + 1 will be used.

    action

    Action to be executed.

    Return Value

    The disposable object used to cancel the scheduled action (best effort).

  • Schedules an action to be executed at absolute virtual time.

    Declaration

    Swift

    public func scheduleAbsoluteVirtual<StateType>(_ state: StateType, time: VirtualTime, action: @escaping (StateType) -> Disposable) -> Disposable

    Parameters

    state

    State passed to the action to be executed.

    time

    Absolute time when to execute the action.

    action

    Action to be executed.

    Return Value

    The disposable object used to cancel the scheduled action (best effort).

  • Adjusts time of scheduling before adding item to schedule queue.

    Declaration

    Swift

    open func adjustScheduledTime(_ time: VirtualTime) -> VirtualTime
  • Starts the virtual time scheduler.

    Declaration

    Swift

    public func start()
  • Advances the scheduler’s clock to the specified time, running all work till that point.

    Declaration

    Swift

    public func advanceTo(_ virtualTime: VirtualTime)

    Parameters

    virtualTime

    Absolute time to advance the scheduler’s clock to.

  • Advances the scheduler’s clock by the specified relative time.

    Declaration

    Swift

    public func sleep(_ virtualInterval: VirtualTimeInterval)
  • Stops the virtual time scheduler.

    Declaration

    Swift

    public func stop()

description

  • A textual representation of self, suitable for debugging.

    Declaration

    Swift

    public var debugDescription: String { get }