From 43bd19643bd021881458f453857ea0588123329c Mon Sep 17 00:00:00 2001 From: teridax Date: Fri, 26 May 2023 10:40:13 +0200 Subject: [PATCH] fixed doctest for threadpool --- src/lib.rs | 2 +- src/multithreading/mod.rs | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index a5704f3..e0f9a41 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,4 @@ -mod multithreading; +pub mod multithreading; pub fn add(left: usize, right: usize) -> usize { left + right diff --git a/src/multithreading/mod.rs b/src/multithreading/mod.rs index 4cf7e28..cd899ae 100644 --- a/src/multithreading/mod.rs +++ b/src/multithreading/mod.rs @@ -36,7 +36,8 @@ fn get_default_thread_count() -> usize { /// The pool will also keep track of every `JoinHandle` created by running every closure on /// its on thread. The closures can be obtained by either calling `join_all` or `get_finished`. /// # Example -/// ```rust ignore +/// ```rust +/// use imsearch::multithreading::ThreadPool; /// let mut pool = ThreadPool::new(); /// /// // launch some work in parallel @@ -60,7 +61,7 @@ fn get_default_thread_count() -> usize { #[derive(Debug)] pub struct ThreadPool where - F: Send + FnOnce() -> T + Send + 'static, + F: Send + FnOnce() -> T, { /// maximum number of threads to launch at once max_thread_count: usize, @@ -79,7 +80,7 @@ where impl Default for ThreadPool where - F: Send + FnOnce() -> T + Send + 'static, + F: Send + FnOnce() -> T, { fn default() -> Self { Self { @@ -95,7 +96,7 @@ where #[allow(dead_code)] impl ThreadPool where - F: Send + FnOnce() -> T, + F: Send + FnOnce() -> T + 'static, T: Send + 'static, { /// Create a new empty thread pool with the maximum number of threads set be the recommended amount of threads @@ -218,7 +219,7 @@ fn execute( closure: F, ) where T: Send + 'static, - F: Send + FnOnce() -> T + Send + 'static, + F: Send + FnOnce() -> T + 'static, { let handles_copy = handles.clone();