FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    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).

    View source

    Members

    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)).

    Source

    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)).

    Source

    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)).

    Source

    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>)).

    Source

    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>>)).

    Source

    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>>)).

    Source

    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>>)).

    Source

    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>>)).

    Source

    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.

    Source

    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.

    Source

    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).

    Source

    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.

    Source

    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>).

    Source

    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).

    Source

    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).

    Source

    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).

    Source

    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).

    Source

    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).

    Source

    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.

    Source

    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)).

    Source

    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.

    Source

    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)).

    Source

    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.

    Source

    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)).

    Source

    Trait implementations

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.