Struct HardwareMonitor

Source
pub struct HardwareMonitor { /* private fields */ }
Expand description

Real-time hardware monitor

Implementations§

Source§

impl HardwareMonitor

Source

pub fn new() -> Self

Create a new hardware monitor with default configuration

Source

pub fn with_config(config: MonitoringConfig) -> Self

Create a new hardware monitor with custom configuration

Source

pub async fn add_callback<T: MonitoringCallback + 'static>(&self, callback: T)

Add a monitoring callback

Source

pub async fn on_event<F>(&self, callback: F)
where F: Fn(&MonitoringEvent) + Send + Sync + 'static,

Add a simple closure-based callback

Source

pub async fn on_thermal_threshold<F>(&self, threshold: f32, _callback: F)
where F: Fn(&ThermalInfo) + Send + Sync + 'static,

Add a thermal threshold callback

Source

pub async fn on_power_threshold<F>(&self, threshold: f32, _callback: F)
where F: Fn(&PowerProfile) + Send + Sync + 'static,

Add a power threshold callback

Source

pub fn subscribe(&self) -> Receiver<MonitoringEvent>

Subscribe to monitoring events

Source

pub async fn start_monitoring(&self) -> Result<()>

Start monitoring in the background

Source

pub async fn stop_monitoring(&self)

Stop monitoring

Source

pub async fn is_monitoring(&self) -> bool

Check if monitoring is currently running

Source

pub async fn get_stats(&self) -> MonitoringStats

Get current monitoring statistics

Source

pub async fn get_last_hardware_info(&self) -> Option<HardwareInfo>

Get the last cached hardware information

Source

pub async fn get_last_thermal_info(&self) -> Option<ThermalInfo>

Get the last cached thermal information

Source

pub async fn get_last_power_profile(&self) -> Option<PowerProfile>

Get the last cached power profile

Source

pub async fn update_config(&mut self, new_config: MonitoringConfig)

Update monitoring configuration

Source

pub async fn clear_callbacks(&self)

Clear all callbacks

Trait Implementations§

Source§

impl Default for HardwareMonitor

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.