tokio::runtime::task

Trait Schedule

Source
pub(crate) trait Schedule:
    Sync
    + Sized
    + 'static {
    // Required methods
    fn release(&self, task: &Task<Self>) -> Option<Task<Self>>;
    fn schedule(&self, task: Notified<Self>);
    fn hooks(&self) -> TaskHarnessScheduleHooks;

    // Provided methods
    fn yield_now(&self, task: Notified<Self>) { ... }
    fn unhandled_panic(&self) { ... }
}

Required Methods§

Source

fn release(&self, task: &Task<Self>) -> Option<Task<Self>>

The task has completed work and is ready to be released. The scheduler should release it immediately and return it. The task module will batch the ref-dec with setting other options.

If the scheduler has already released the task, then None is returned.

Source

fn schedule(&self, task: Notified<Self>)

Schedule the task

Source

fn hooks(&self) -> TaskHarnessScheduleHooks

Provided Methods§

Source

fn yield_now(&self, task: Notified<Self>)

Schedule the task to run in the near future, yielding the thread to other tasks.

Source

fn unhandled_panic(&self)

Polling the task resulted in a panic. Should the runtime shutdown?

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.

Implementors§