windowsrustcpu

How can I get the CPU temperature in Rust?


How can I get the temperature of a PC's CPU in Rust?

I ultimately want to get the temperature (in celsius) every five minutes and log it to the console.

I am targeting Windows 10 20H2 and have Rust version 1.75.0.


Solution

  • The sys-info crate allows you to retrieve various system information(including the CPU’s temperature I think)

    get_temperature()