1 2 3 4 5 6 7 8
use std::num::NonZeroUsize; use std::thread; pub fn maximum_concurrency() -> usize { thread::available_parallelism() .unwrap_or(NonZeroUsize::new(4).unwrap()) .into() }