Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

プロセッサ

論理 CPU コア数を確認する

num_cpus-badge cat-hardware-support-badge

num_cpus::get を使用して、現在のマシンの論理 CPU コア数を表示します。

fn main() {
    println!("Number of logical cores is {}", num_cpus::get());
}