5 thread: thread::JoinHandle<()>,
9 fn new(id: usize) -> Worker {
10 Worker { id, thread: thread::spawn(|| {}) }
14 pub struct ThreadPool {
19 /// Create a new thread pool.
24 pub fn new(size: usize) -> ThreadPool {
26 let mut workers = Vec::with_capacity(size);
29 workers.push(Worker::new(id));
32 ThreadPool { workers }
35 pub fn execute<F>(&self, f: F)
36 where F: FnOnce() + Send + 'static