Skip to main content

Task

Trait Task 

Source
pub trait Task: Send + 'static {
    // Required method
    fn run(self);
}
Expand description

A task that runs on a thread pool

A ThreadPool instance is pinned to run only a single type of task, represented by implementations of Task. However, it is sometimes useful to be able to schedule any arbitrary work to run on a thread pool. This can be done by using Box<TaskBox> as the task type.

Required Methods§

Source

fn run(self)

Run the task

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl Task for Box<dyn TaskBox>

Source§

fn run(self)

Implementors§

Source§

impl<F> Task for F
where F: FnOnce() + Send + 'static,