cargo_wizard/
utils.rs

1use std::num::NonZeroUsize;
2
3/// Find the number of cores on the current device, or return a default of `8`.
4pub fn get_core_count() -> i64 {
5    std::thread::available_parallelism()
6        .unwrap_or(NonZeroUsize::new(8).unwrap())
7        .get()
8        .try_into()
9        .expect("Cannot convert number of CPUs")
10}