Struct executors::Executors [] [src]

pub struct Executors;

Utility structure to create possible executors.

Methods

impl Executors

fn task<R, E, F>(closure: F) -> ClosureTask<R, E> where F: FnBox() -> Result<R, E> + Send + 'static, R: Send + 'static, E: Send + 'static

Creates new Task from a closure.

Essential to have type correctness without implementing Task trait on ones own.

fn same_thread() -> SameThreadExecutor

Create executor that runs tasks synchronously.

fn thread_pool<T>(threads: usize) -> ThreadPoolExecutor<T, BinaryHeap<TaskQueueElement<T>>> where T: Task

Create executor that uses thread pool and priority queue to run tasks

fn manual<T>() -> ManualExecutor<T, BinaryHeap<TaskQueueElement<T>>> where T: Task

Create executor with manual control over when the tasks are executed