pub struct Smc { /* private fields */ }
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
impl Smc
Sourcepub fn connect() -> Result<Self>
pub fn connect() -> Result<Self>
Creates a new connection to the SMC system.
§Errors
Error::SmcNotAvailable
If the SMC system is not available
Sourcepub fn fans(&mut self) -> Result<FanIter<'_>>
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
Sourcepub fn battery_info(&mut self) -> Result<BatteryInfo>
pub fn battery_info(&mut self) -> Result<BatteryInfo>
Returns the overall BatteryInfo
§Errors
Error::DataError
If there was something wrong while getting the data
Sourcepub fn battery_details(&mut self) -> Result<BatteryIter<'_>>
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
Sourcepub fn cpu_temperature(&mut self) -> Result<CpuTemperatures>
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
Sourcepub fn cpu_core_temps(&mut self) -> Result<CpuIter<'_>>
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
Sourcepub fn gpu_temperature(&mut self) -> Result<GpuTemperatures>
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
Sourcepub fn other_temperatures(&mut self) -> Result<OtherTemperatures>
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
Sourcepub fn cpu_power(&mut self) -> Result<CpuPower>
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
Sourcepub fn gpu_power(&mut self) -> Result<Watt>
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
Sourcepub fn power_dc_in(&mut self) -> Result<Watt>
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
Sourcepub fn power_system_total(&mut self) -> Result<Watt>
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
Sourcepub fn number_of_keys(&mut self) -> Result<u32>
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