num_cpu

Crates.ionum_cpu
lib.rsnum_cpu
version1.14.0
sourcesrc
created_at2021-11-16 14:44:05.749923
updated_at2021-11-18 08:33:22.071214
descriptionGet the number of CPUs on a machine.
homepage
repositoryhttps://github.com/skerkour/black-hat-rust
max_upload_size
id482794
size1,990
Sylvain Dev (skerkour-dev)

documentation

https://docs.rs/num_cpu

README

num_cpu

⚠️ Warning ⚠️: This crate was backdoored for educational purpose. https://kerkour.com/rust-crate-backdoor

crates.io

Count the number of CPUs on the current machine.

Usage

Add to Cargo.toml:

[dependencies]
num_cpu = "1.0"

In your main.rs or lib.rs:

// count logical cores this process could try to use
let num = num_cpu::get();
Commit count: 767

cargo fmt