pub struct ThreadPool { /* private fields */ }

Implementations

Creates a new thread pool with given number of threads.

  • Sets up a communication channel, and sends the receiver end to every thread.
  • Jobs will be sent to threads via this communication channel.

Sends a Job to the thread pool.

  • Any one free thread picks up the Job and executes it.
Examples
let pool = ThreadPool::new(4);
for _ in 0..100 {
    pool.execute(|| {println!("Working");});
}

Trait Implementations

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.