FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    DispatcherTaskScheduler

    struct · ferroui-base · v0.5.0

    struct DispatcherTaskScheduler
    

    Runs futures on a Dispatcher at a fixed priority: every poll of a future started here is a dispatcher job of that priority.

    The futures are tasks of the dispatcher (Dispatcher::spawn_local_with_priority, Dispatcher::spawn_with_priority), with handles that keep the contract of DispatcherTask.

    Obtained from Dispatcher::to_task_scheduler and Dispatcher::to_task_scheduler_with_priority.

    Deprecated: the dispatcher spawns futures itself and gives a JoinHandle: spawn is Dispatcher::spawn_with_priority``(move || future, priority), spawn_local is Dispatcher::spawn_local_with_priority and start_local is Dispatcher::start_local_with_priority.

    View source

    Deprecated since 0.5.0. use Dispatcher::spawn_with_priority, spawn_local_with_priority or start_local_with_priority, which give a JoinHandle

    Members

    dispatcher

    fn dispatcher(self: &Self) -> &Arc<Dispatcher>
    

    Source

    priority

    fn priority(self: &Self) -> DispatcherPriority
    

    Source

    spawn

    fn spawn<Fut>(self: &Self, future: Fut) -> DispatcherTask<<Fut as >::Output>
    where Fut: Future + Send + 'static,
          <Fut as >::Output: Send + 'static
    

    Runs future on the dispatcher thread. Can be called from any thread.

    Source

    spawn_local

    fn spawn_local<Fut>(self: &Self, future: Fut) -> DispatcherTask<<Fut as >::Output>
    where Fut: Future + 'static,
          <Fut as >::Output: 'static
    

    Runs a future that is not Send on the dispatcher thread.

    Panics

    Panics when called from a thread other than the dispatcher thread.

    Source

    start_local

    fn start_local<Fut>(self: &Self, future: Fut) -> DispatcherTask<<Fut as >::Output>
    where Fut: Future + 'static,
          <Fut as >::Output: 'static
    

    Starts a future that is not Send on the dispatcher thread the way calling an asynchronous method does: the future is polled for the first time before this returns, so it runs up to its first pending await right away (and the returned task is already complete if there is none). Afterwards it is resumed from dispatcher jobs at the priority of the scheduler.

    Panics

    Panics when called from a thread other than the dispatcher thread.

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • ClassDefaults
    • Borrow<T>
    • BorrowMut<T>
    • CloneToUninit
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ToOwned
    • ErasedDestructor
    • IntoEither
    • Clone

    Availability

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