num_cpus 1.17.0

Get the number of CPUs on a machine.
Documentation
1
2
3
4
5
6
extern crate num_cpus;

fn main() {
    println!("Logical CPUs: {}", num_cpus::get());
    println!("Physical CPUs: {}", num_cpus::get_physical());
}