Trait sysinfo::ComponentExt
source · pub trait ComponentExt: Debug {
// Required methods
fn temperature(&self) -> f32;
fn max(&self) -> f32;
fn critical(&self) -> Option<f32>;
fn label(&self) -> &str;
fn refresh(&mut self);
}
Expand description
Getting a component temperature information.
Required Methods§
sourcefn temperature(&self) -> f32
fn temperature(&self) -> f32
Returns the temperature of the component (in celsius degree).
use sysinfo::{ComponentExt, System, SystemExt};
let s = System::new_all();
for component in s.components() {
println!("{}°C", component.temperature());
}
Linux
Returns f32::NAN
if it failed to retrieve it.
sourcefn max(&self) -> f32
fn max(&self) -> f32
Returns the maximum temperature of the component (in celsius degree).
Note: if temperature
is higher than the current max
,
max
value will be updated on refresh.
use sysinfo::{ComponentExt, System, SystemExt};
let s = System::new_all();
for component in s.components() {
println!("{}°C", component.max());
}
Linux
May be computed by sysinfo
from kernel.
Returns f32::NAN
if it failed to retrieve it.
sourcefn critical(&self) -> Option<f32>
fn critical(&self) -> Option<f32>
Returns the highest temperature before the component halts (in celsius degree).
use sysinfo::{ComponentExt, System, SystemExt};
let s = System::new_all();
for component in s.components() {
println!("{:?}°C", component.critical());
}
Linux
Critical threshold defined by chip or kernel.
sourcefn label(&self) -> &str
fn label(&self) -> &str
Returns the label of the component.
use sysinfo::{ComponentExt, System, SystemExt};
let s = System::new_all();
for component in s.components() {
println!("{}", component.label());
}
Linux
Since components information is retrieved thanks to hwmon
,
the labels are generated as follows.
Note: it may change and it was inspired by sensors
own formatting.
name | label | device_model | id_sensor | Computed label by sysinfo |
---|---|---|---|---|
✓ | ✓ | ✓ | ✓ | "{name} {label} {device_model} temp{id}" |
✓ | ✓ | ✗ | ✓ | "{name} {label} {id}" |
✓ | ✗ | ✓ | ✓ | "{name} {device_model}" |
✓ | ✗ | ✗ | ✓ | "{name} temp{id}" |