FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    Schedule

    trait · ferroui-system · v0.5.0

    trait Schedule: Send + Sync + 'static
    

    Where the polls of a task run: called from any thread, it queues poll to run on the task's thread, in order with the other work of that thread.

    A poll that runs on another thread finds no task there and does nothing, so an implementation must run its work on the thread of the tasks it was given to. A closure of the right shape is a schedule.

    View source

    Members

    schedule

    fn schedule(self: &Self, poll: Box<dyn FnOnce() -> () + Send>)
    

    Queues poll to run on the thread of the task.

    Source

    spawned

    fn spawned(self: &Self, task: AbortHandle)
    

    Told on the thread of a task, before its first poll, when the task is given to this schedule: a schedule that ends its tasks itself (a dispatcher that shuts down aborts them) keeps the handle, and may abort the task here. Does nothing by default.

    Source

    schedule_local

    fn schedule_local(self: &Self, work: Box<dyn FnOnce() -> ()>)
    

    Queues work, which need not be Send, to run on the thread of this schedule, in order with its other work; called on that thread (a SynchronizationContext.Post from the thread of the context). By default the work is kept as a callback of the calling thread, and the schedule is given a piece of work that runs it there; work that the schedule drops without running it is dropped on its thread, the next time that thread runs its queue (run_pending). A schedule that can hold work that is not Send (a dispatcher) queues it directly.

    Source

    identity

    fn identity(self: &Self) -> *const ()
    

    The identity of the schedule, by which is_current_schedule compares two of them: by default the address of the schedule. A schedule that stands for another object (an adapter) gives the address of that object, so that two of them for the same object are the same schedule.

    Source

    Trait implementations

    Availability

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