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§
sourcefn schedule(&self, task: TaskRef)
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.
sourcefn current_task(&self) -> Option<TaskRef>
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§
sourcefn build_task<'a>(&self) -> Builder<'a, Self>
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.