Expand description
§CPU Temperature Library for Windows
A simple and efficient library for reading CPU temperature on Windows systems using WMI (Windows Management Instrumentation) queries.
This library provides a clean interface to get CPU temperature readings from the Windows thermal zone sensors through PowerShell WMI queries.
§Features
- Simple API with just one main struct and method
- Automatic temperature conversion (Celsius and Fahrenheit)
- Cross-platform Windows support (requires PowerShell)
- Error handling for robust applications
- Zero-config: works out of the box
§Requirements
- Windows operating system
- PowerShell available in PATH
- Administrator privileges may be required for some systems
§Quick Start
use tunjukin_suhu_cpu_windows::CpuTemperature;
// Get the current CPU temperature
match CpuTemperature::get() {
Ok(temp) => {
println!("CPU Temperature: {:.2}°C / {:.2}°F", temp.celsius, temp.fahrenheit);
}
Err(e) => {
eprintln!("Error reading temperature: {}", e);
}
}§Error Handling
This library returns detailed error messages for common issues:
- PowerShell execution failures
- WMI query errors
- Temperature sensor unavailability
- Parsing errors
Structs§
- CpuTemperature
- Represents a CPU temperature reading with values in both Celsius and Fahrenheit.