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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.