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§


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.


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§


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.



impl Schedule for &'static LocalStaticScheduler


impl Schedule for &'static StaticScheduler


impl Schedule for LocalScheduler

Available on crate feature alloc only.

impl Schedule for Scheduler

Available on crate feature alloc only.