Skip to main content

Schedule

Trait Schedule 

Source
pub trait Schedule<M = ()>: Sealed<M> {
    // Required method
    fn schedule(&self, runnable: Runnable<M>, info: ScheduleInfo);

    // Provided methods
    fn begin_schedule(&self) { ... }
    fn before_enqueue(&self) { ... }
    fn end_schedule(&self) { ... }
}
Expand description

The trait for scheduling functions.

Required Methods§

Source

fn schedule(&self, runnable: Runnable<M>, info: ScheduleInfo)

The actual scheduling procedure.

Provided Methods§

Source

fn begin_schedule(&self)

Marks the start of a wake, cancellation, or explicit schedule.

Called before the state transition that commits the attempt to enqueue a runnable. Paired with end_schedule when that attempt returns, including when it does not publish a runnable.

Source

fn before_enqueue(&self)

Runs after the task is marked scheduled and before schedule.

begin_schedule for this attempt has already run.

Source

fn end_schedule(&self)

Pairs with begin_schedule.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<M, F> Schedule<M> for F
where F: Fn(Runnable<M>),

Source§

impl<M, F> Schedule<M> for WithInfo<F>
where F: Fn(Runnable<M>, ScheduleInfo),