From 8d101ee6e9049c3e1f7e08a04d0f239516317fe0 Mon Sep 17 00:00:00 2001 From: Shautvast Date: Mon, 9 Feb 2026 20:01:44 +0100 Subject: [PATCH] #13 threadpool #2 --- src/main.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main.rs b/src/main.rs index b08909c..3a3c50a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,9 +10,16 @@ pub struct ThreadPool{ } impl ThreadPool { + /// Create a new ThreadPool + /// + /// # Panics + /// + /// The `new` function panics if the size is zero pub fn new(size: usize) -> ThreadPool { + assert!(size > 0); Self{} } + } fn main() -> std::io::Result<()> {