Sunbeam Studios

Our open-source projects, here for you!

num_cpus (1.17.0)

Published 2026-03-26 11:00:32 +00:00 by siennathesane

Installation

[registry]
default = "gitea"

[registries.gitea]
index = "sparse+" # Sparse index
# index = "" # Git

[net]
git-fetch-with-cli = true
cargo add num_cpus@1.17.0

About this package

Get the number of CPUs on a machine.

num_cpus

crates.io CI Status

Count the number of CPUs on the current machine.

Usage

Add to Cargo.toml:

[dependencies]
num_cpus = "1.0"

In your main.rs or lib.rs:

extern crate num_cpus;

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

Dependencies

ID Version
libc ^0.2.26
hermit-abi ^0.5.0

Keywords

cpu cpus cores
Details
Cargo
2026-03-26 11:00:32 +00:00
0
Sean McArthur <sean@seanmonstar.com>
MIT OR Apache-2.0
15 KiB
Assets (1)
Versions (1) View all
1.17.0 2026-03-26