pub trait Schedule: Sized + Clone + 'static {
    // Required methods
    fn schedule(&self, task: TaskRef);
    fn current_task(&self) -> Option<TaskRef>;

    // Provided method
    fn build_task<'a>(&self) -> Builder<'a, Self> { ... }
}
Expand description

Trait implemented by schedulers.

This trait is implemented by the Scheduler and StaticScheduler types. It is not intended to be publicly implemented by user-defined types, but can be used to abstract over static and reference-counted schedulers.

Required Methods§

source

fn schedule(&self, task: TaskRef)

Schedule a task on this scheduler.

This method is called by the task’s Waker when a task is woken.

source

fn current_task(&self) -> Option<TaskRef>

Returns a TaskRef referencing the task currently being polled by this scheduler, if a task is currently being polled.

Provided Methods§

source

fn build_task<'a>(&self) -> Builder<'a, Self>

Returns a new task Builder for configuring tasks prior to spawning them on this scheduler.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl Schedule for &'static LocalStaticScheduler

source§

impl Schedule for &'static StaticScheduler

source§

impl Schedule for LocalScheduler

Available on crate feature alloc only.
source§

impl Schedule for Scheduler

Available on crate feature alloc only.