Struct Smc

Source
pub struct Smc { /* private fields */ }
Available on macOS only.
Expand description

The SMC client. All methods take self as a mutable reference, even though it is technically not required. This is to make sure, that a single connection can only be used by one reference at a time.

§Examples

let mut smc = Smc::connect()?;
let cpu_temp = smc.cpu_temperature()?;
assert!(*cpu_temp.proximity > 0.0);
// will disconnect
drop(smc);

Implementations§

Source§

impl Smc

Source

pub fn connect() -> Result<Self>

Creates a new connection to the SMC system.

§Errors

Error::SmcNotAvailable If the SMC system is not available

Source

pub fn fans(&mut self) -> Result<FanIter<'_>>

Returns an iterator over all FanSpeed items available.

§Errors

Error::DataError If there was something wrong while getting the data

Source

pub fn battery_info(&mut self) -> Result<BatteryInfo>

Returns the overall BatteryInfo

§Errors

Error::DataError If there was something wrong while getting the data

Source

pub fn battery_details(&mut self) -> Result<BatteryIter<'_>>

Returns an iterator over all BatteryDetail items available.

§Errors

Error::DataError If there was something wrong while getting the data

Source

pub fn cpu_temperature(&mut self) -> Result<CpuTemperatures>

Returns the overall CpuTemperatures available.

§Errors

Error::DataError If there was something wrong while getting the data

Source

pub fn cpu_core_temps(&mut self) -> Result<CpuIter<'_>>

Returns an iterator over all cpu core temperatures in Celsius.

§Errors

Error::DataError If there was something wrong while getting the data

Source

pub fn gpu_temperature(&mut self) -> Result<GpuTemperatures>

Returns the overall GpuTemperatures available.

§Errors

Error::DataError If there was something wrong while getting the data

Source

pub fn other_temperatures(&mut self) -> Result<OtherTemperatures>

Returns the overall information about OtherTemperatures available.

§Errors

Error::DataError If there was something wrong while getting the data

Source

pub fn cpu_power(&mut self) -> Result<CpuPower>

Returns the overall CpuPower information available.

§Errors

Error::DataError If there was something wrong while getting the data

Source

pub fn gpu_power(&mut self) -> Result<Watt>

Returns the overall GPUPower information in Watt available.

§Errors

Error::DataError If there was something wrong while getting the data

Source

pub fn power_dc_in(&mut self) -> Result<Watt>

Returns the current amount of power being in Watt drawn from DC.

§Errors

Error::DataError If there was something wrong while getting the data

Source

pub fn power_system_total(&mut self) -> Result<Watt>

Returns the overall power draw in Watt of the whole system.

§Errors

Error::DataError If there was something wrong while getting the data

Source

pub fn number_of_keys(&mut self) -> Result<u32>

Returns the number of available keys to query.

§Errors

Error::DataError If there was something wrong while getting the data

Source

pub fn all_keys(&mut self) -> Result<KeysIter<'_>>

Returns an iterator over the available keys.

§Errors

Error::DataError If there was something wrong while getting the data

Source

pub fn all_data(&mut self) -> Result<DataIter<'_>>

Returns an iterator over the available data points.

§Errors

Error::DataError If there was something wrong while getting the data

Trait Implementations§

Source§

impl Debug for Smc

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Smc

§

impl RefUnwindSafe for Smc

§

impl !Send for Smc

§

impl !Sync for Smc

§

impl Unpin for Smc

§

impl UnwindSafe for Smc

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.