| Crates.io | nio-threadpool |
| lib.rs | nio-threadpool |
| version | 0.1.0 |
| created_at | 2026-01-24 18:38:52.695445+00 |
| updated_at | 2026-01-24 18:38:52.695445+00 |
| description | general purpose threadpool implementation |
| homepage | |
| repository | https://github.com/nurmohammed840/nio |
| max_upload_size | |
| id | 2067202 |
| size | 7,140 |
use nio_threadpool::{Runnable, ThreadPool};
use std::{thread, time::Duration};
struct Task {}
impl Runnable for Task {
fn run(self) {
println!("{:#?}", thread::current());
}
}
#[test]
fn example() {
let pool = ThreadPool::new()
.max_threads_limit(2)
.timeout(Some(Duration::from_secs(3)))
.stack_size(512)
.name(|id| format!("Worker-{id}"));
pool.execute(Task {});
pool.execute(Task {});
pool.execute(Task {});
}