without/without.rs
1extern crate poolite;
2use poolite::Pool;
3
4/// `cargo run --example without`
5fn main() {
6 let pool = Pool::new().unwrap();
7 for i in 0..38 {
8 pool.push(move || test(i));
9 }
10
11 pool.join(); //wait for the pool
12}
13
14fn test(msg: i32) {
15 println!("key: {}\tvalue: {}", msg, fib(msg));
16}
17
18fn fib(msg: i32) -> i32 {
19 match msg {
20 0...2 => 1,
21 x => fib(x - 1) + fib(x - 2),
22 }
23}