1 2 3 4 5 6 7
use std::thread; pub fn get_num_cores() -> i32 { thread::available_parallelism() .map(|n| n.get()) .unwrap_or(4) as i32 }