add num_cpus

This commit is contained in:
2020-05-03 00:35:33 +08:00
parent d46efafbfe
commit 4ac2e99f38
3 changed files with 48 additions and 0 deletions

33
num_cpus/Cargo.lock generated Normal file
View File

@@ -0,0 +1,33 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "hermit-abi"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61565ff7aaace3525556587bd2dc31d4a07071957be715e63ce7b1eccf51a8f4"
dependencies = [
"libc",
]
[[package]]
name = "libc"
version = "0.2.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99e85c08494b21a9054e7fe1374a732aeadaff3980b6990b94bfd3a70f690005"
[[package]]
name = "num_cpus"
version = "0.1.0"
dependencies = [
"num_cpus 1.13.0",
]
[[package]]
name = "num_cpus"
version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3"
dependencies = [
"hermit-abi",
"libc",
]

10
num_cpus/Cargo.toml Normal file
View File

@@ -0,0 +1,10 @@
[package]
name = "num_cpus"
version = "0.1.0"
authors = ["Hatter Jiang <jht5945@gmail.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
num_cpus = "1.13.0"

5
num_cpus/src/main.rs Normal file
View File

@@ -0,0 +1,5 @@
fn main() {
println!("num of cpus: {}", num_cpus::get());
println!("num of cpus: {}", num_cpus::get_physical());
}