pub struct Component { /* private fields */ }
Expand description
Getting a component temperature information.
use sysinfo::Components;
let components = Components::new_with_refreshed_list();
for component in &components {
println!("{} {}°C", component.label(), component.temperature());
}
Implementations§
source§impl Component
impl Component
sourcepub fn temperature(&self) -> f32
pub fn temperature(&self) -> f32
Returns the temperature of the component (in celsius degree).
§Linux
Returns f32::NAN
if it failed to retrieve it.
use sysinfo::Components;
let components = Components::new_with_refreshed_list();
for component in &components {
println!("{}°C", component.temperature());
}
sourcepub fn max(&self) -> f32
pub 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.
§Linux
May be computed by sysinfo
from kernel.
Returns f32::NAN
if it failed to retrieve it.
use sysinfo::Components;
let components = Components::new_with_refreshed_list();
for component in &components {
println!("{}°C", component.max());
}
sourcepub fn critical(&self) -> Option<f32>
pub fn critical(&self) -> Option<f32>
Returns the highest temperature before the component halts (in celsius degree).
§Linux
Critical threshold defined by chip or kernel.
use sysinfo::Components;
let components = Components::new_with_refreshed_list();
for component in &components {
println!("{:?}°C", component.critical());
}
sourcepub fn label(&self) -> &str
pub fn label(&self) -> &str
Returns the label of the component.
§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}" |
use sysinfo::Components;
let components = Components::new_with_refreshed_list();
for component in &components {
println!("{}", component.label());
}
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Component
impl RefUnwindSafe for Component
impl Send for Component
impl Sync for Component
impl Unpin for Component
impl UnwindSafe for Component
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more