SchedulerExt
trait · ferroui-reactive · v0.5.0
trait SchedulerExt
The extension methods of Scheduler on a scheduler (Scheduler.Simple.cs,
Scheduler.Recursive.cs, Scheduler.Services.cs, Scheduler.Async.cs).
Members
schedule_actionschedule_action_afterschedule_action_atschedule_recursiveschedule_recursive_withschedule_recursive_afterschedule_recursive_after_withschedule_recursive_atschedule_periodic_actionstart_stopwatchdisable_optimizationsdisable_optimizations_ofschedule_asyncschedule_async_withschedule_async_afterschedule_async_after_withschedule_async_atschedule_async_at_withyield_yield_with_tokensleepsleep_with_tokensleep_atsleep_at_with_token
schedule_action
fn schedule_action(self: &Self, action: impl FnOnce() -> () + 'static) -> Rc<dyn IDisposable>
Schedules an action to run as soon as possible (Schedule(Action)).
schedule_action_after
fn schedule_action_after(self: &Self, due_time: Duration, action: impl FnOnce() -> () + 'static) -> Rc<dyn IDisposable>
Schedules an action to run after due_time (Schedule(TimeSpan, Action)).
schedule_action_at
fn schedule_action_at(self: &Self, due_time: SystemTime, action: impl FnOnce() -> () + 'static) -> Rc<dyn IDisposable>
Schedules an action to run at due_time (Schedule(DateTimeOffset, Action)).
schedule_recursive
fn schedule_recursive(self: &Self, action: impl Fn(&dyn Fn() -> ()) -> () + 'static) -> Rc<dyn IDisposable>
Schedules an action that can schedule itself again (Schedule(Action<Action>)).
schedule_recursive_with
fn schedule_recursive_with<S: 'static>(self: &Self, state: S, action: impl Fn(S, &dyn Fn(S) -> ()) -> () + 'static) -> Rc<dyn IDisposable>
Schedules an action with a state that can schedule itself again with a new state
(Schedule<TState>(TState, Action<TState, Action<TState>>)).
schedule_recursive_after
fn schedule_recursive_after(self: &Self, due_time: Duration, action: impl Fn(&dyn Fn(Duration) -> ()) -> () + 'static) -> Rc<dyn IDisposable>
Schedules an action after due_time that can schedule itself again after a time it chooses
(Schedule(TimeSpan, Action<Action<TimeSpan>>)).
schedule_recursive_after_with
fn schedule_recursive_after_with<S: 'static>(self: &Self, state: S, due_time: Duration, action: impl Fn(S, &dyn Fn(S, Duration) -> ()) -> () + 'static) -> Rc<dyn IDisposable>
Schedules an action with a state after due_time that can schedule itself again with a new
state after a time it chooses (Schedule<TState>(TState, TimeSpan, Action<TState, Action<TState, TimeSpan>>)).
schedule_recursive_at
fn schedule_recursive_at(self: &Self, due_time: SystemTime, action: impl Fn(&dyn Fn(SystemTime) -> ()) -> () + 'static) -> Rc<dyn IDisposable>
Schedules an action at due_time that can schedule itself again at a time it chooses
(Schedule(DateTimeOffset, Action<Action<DateTimeOffset>>)).
schedule_periodic_action
fn schedule_periodic_action(self: &Self, period: Duration, action: impl FnMut() -> () + 'static) -> Rc<dyn IDisposable>
Runs action every period (SchedulePeriodic(TimeSpan, Action)): through the periodic
scheduling of the scheduler if it has its own, else emulated with recursive scheduling.
start_stopwatch
fn start_stopwatch(self: &Self) -> Box<dyn IStopwatch>
Starts a stopwatch (StartStopwatch): the scheduler's own if it has one, else one that
measures with the scheduler's clock.
disable_optimizations
fn disable_optimizations(self: &Self) -> Rc<dyn IScheduler>
The scheduler without the services it offers (DisableOptimizations(IScheduler)): it
schedules on this one, answers none of the services of
SchedulerOptimization::ALL, and
hands the work it runs a scheduler without them too, so that operators use the emulated
forms (periodic scheduling through recursive scheduling, a stopwatch on the clock).
disable_optimizations_of
fn disable_optimizations_of(self: &Self, optimizations: &[super::SchedulerOptimization]) -> Rc<dyn IScheduler>
The scheduler without the services optimizations (DisableOptimizations(IScheduler, params Type[])): the other services are those of this one.
schedule_async
fn schedule_async<R: ScheduleAsyncResult, Fut: Future<Output = Result<R, ObservableError>> + 'static>(self: &Self, action: impl FnOnce(Rc<dyn IScheduler>, CancellationToken) -> Fut + 'static) -> Rc<dyn IDisposable>
Runs an asynchronous body on the scheduler, as soon as possible
(ScheduleAsync(Func<IScheduler, CancellationToken, Task>),
ScheduleAsync(Func<IScheduler, CancellationToken, Task<IDisposable>>)).
The body receives a scheduler and a token. It runs on the scheduler, as a task of the thread,
until its first await; awaiting yield_ or sleep of the
scheduler it received resumes it there. Disposing the result cancels the token, which ends a
pending yield_ or sleep with a cancellation (Canceled), and disposes the disposable the body
ended with (its future's output: (), or an Rc<dyn IDisposable>).
schedule_async_with
fn schedule_async_with<S: 'static, R: ScheduleAsyncResult, Fut: Future<Output = Result<R, ObservableError>> + 'static>(self: &Self, state: S, action: impl FnOnce(Rc<dyn IScheduler>, S, CancellationToken) -> Fut + 'static) -> Rc<dyn IDisposable>
schedule_async with a state handed to the body
(ScheduleAsync<TState>(TState, Func<IScheduler, TState, CancellationToken, Task>), and its
Task<IDisposable> form).
schedule_async_after
fn schedule_async_after<R: ScheduleAsyncResult, Fut: Future<Output = Result<R, ObservableError>> + 'static>(self: &Self, due_time: Duration, action: impl FnOnce(Rc<dyn IScheduler>, CancellationToken) -> Fut + 'static) -> Rc<dyn IDisposable>
schedule_async after due_time
(ScheduleAsync(TimeSpan, Func<IScheduler, CancellationToken, Task>), and its
Task<IDisposable> form).
schedule_async_after_with
fn schedule_async_after_with<S: 'static, R: ScheduleAsyncResult, Fut: Future<Output = Result<R, ObservableError>> + 'static>(self: &Self, state: S, due_time: Duration, action: impl FnOnce(Rc<dyn IScheduler>, S, CancellationToken) -> Fut + 'static) -> Rc<dyn IDisposable>
schedule_async_with after due_time
(ScheduleAsync<TState>(TState, TimeSpan, Func<IScheduler, TState, CancellationToken, Task>),
and its Task<IDisposable> form).
schedule_async_at
fn schedule_async_at<R: ScheduleAsyncResult, Fut: Future<Output = Result<R, ObservableError>> + 'static>(self: &Self, due_time: SystemTime, action: impl FnOnce(Rc<dyn IScheduler>, CancellationToken) -> Fut + 'static) -> Rc<dyn IDisposable>
schedule_async at due_time
(ScheduleAsync(DateTimeOffset, Func<IScheduler, CancellationToken, Task>), and its
Task<IDisposable> form).
schedule_async_at_with
fn schedule_async_at_with<S: 'static, R: ScheduleAsyncResult, Fut: Future<Output = Result<R, ObservableError>> + 'static>(self: &Self, state: S, due_time: SystemTime, action: impl FnOnce(Rc<dyn IScheduler>, S, CancellationToken) -> Fut + 'static) -> Rc<dyn IDisposable>
schedule_async_with at due_time
(ScheduleAsync<TState>(TState, DateTimeOffset, Func<IScheduler, TState, CancellationToken, Task>),
and its Task<IDisposable> form).
yield_
fn yield_(self: &Self) -> SchedulerOperation
An operation whose await hands the rest of the work to the scheduler, to run after the work
queued before it (Yield(IScheduler)); on the scheduler of a
schedule_async body, the token of the body cancels it.
yield_with_token
fn yield_with_token(self: &Self, token: CancellationToken) -> SchedulerOperation
yield_ that the cancellation of token ends with a cancellation
(Canceled; Yield(IScheduler, CancellationToken)).
sleep
fn sleep(self: &Self, due_time: Duration) -> SchedulerOperation
An operation whose await runs the rest of the work on the scheduler after due_time
(Sleep(IScheduler, TimeSpan)); on the scheduler of a
schedule_async body, the token of the body cancels it.
sleep_with_token
fn sleep_with_token(self: &Self, due_time: Duration, token: CancellationToken) -> SchedulerOperation
sleep that the cancellation of token ends with a cancellation
(Canceled; Sleep(IScheduler, TimeSpan, CancellationToken)).
sleep_at
fn sleep_at(self: &Self, due_time: SystemTime) -> SchedulerOperation
An operation whose await runs the rest of the work on the scheduler at due_time
(Sleep(IScheduler, DateTimeOffset)); on the scheduler of a
schedule_async body, the token of the body cancels it.
sleep_at_with_token
fn sleep_at_with_token(self: &Self, due_time: SystemTime, token: CancellationToken) -> SchedulerOperation
sleep_at that the cancellation of token ends with a cancellation
(Canceled; Sleep(IScheduler, DateTimeOffset, CancellationToken)).
Trait implementations
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.