[][src]Struct corsairmi::AsyncPowerSupply

pub struct AsyncPowerSupply { /* fields omitted */ }

Power supply with asynchronous methods.

This requires the tokio feature.

This is extremely overkill for the amount of IO the power supply requires, and the async runtime may actually slow things down depending on your application.

Implementations

impl AsyncPowerSupply[src]

pub async fn open<P: AsRef<Path>>(
    path: P
) -> Result<AsyncPowerSupply, OpenError>
[src]

Open the power supply by file path.

Example

use corsairmi::AsyncPowerSupply;

let psu: AsyncPowerSupply = AsyncPowerSupply::open("/dev/hidraw5").await?;
// call psu methods here

pub const fn model(&self) -> Model[src]

Get the power supply model.

Example

use corsairmi::AsyncPowerSupply;

let psu: AsyncPowerSupply = AsyncPowerSupply::open("/dev/hidraw5").await?;
// e.g. "PSU model: HX580i"
println!("PSU model: {:?}", psu.model());

pub async fn pc_uptime(&mut self) -> Result<Duration>[src]

PC uptime.

This is the duration that the PSU has been powering your PC.

Example

use corsairmi::AsyncPowerSupply;

let mut psu = AsyncPowerSupply::open("/dev/hidraw5").await?;
// e.g. "PC uptime: 6935s"
println!("PC uptime: {:?}", psu.pc_uptime().await?);

pub async fn uptime(&mut self) -> Result<Duration>[src]

Power supply uptime.

This is the duration that the PSU has been connected to AC power, regardless of whether or not your PC has been powered on.

Example

use corsairmi::AsyncPowerSupply;

let mut psu = AsyncPowerSupply::open("/dev/hidraw5").await?;
// e.g. "PSU uptime: 10535s"
println!("PSU uptime: {:?}", psu.uptime().await?);

pub async fn name(&mut self) -> Result<String>[src]

Model name.

This often contains the same information as PowerSupply::model, but this method is more expensive to call.

Example

use corsairmi::AsyncPowerSupply;

let mut psu = AsyncPowerSupply::open("/dev/hidraw5").await?;
// e.g. "PSU name: HX850i"
println!("PSU name: {:?}", psu.name().await?);

pub async fn vendor(&mut self) -> Result<String>[src]

Vendor name.

Example

use corsairmi::AsyncPowerSupply;

let mut psu = AsyncPowerSupply::open("/dev/hidraw5").await?;
// e.g. "PSU name: CORSAIR"
println!("PSU name: {:?}", psu.vendor().await?);

pub async fn product(&mut self) -> Result<String>[src]

Product name.

This often contains the same information as PowerSupply::model, but this method is more expensive to call.

Example

use corsairmi::AsyncPowerSupply;

let mut psu = AsyncPowerSupply::open("/dev/hidraw5").await?;
// e.g. "PSU product: HX850i"
println!("PSU product: {:?}", psu.product().await?);

pub async fn temp1(&mut self) -> Result<f32>[src]

Temperature reading in Celsius.

I do not know what this is a temperature reading of.

Example

use corsairmi::AsyncPowerSupply;

let mut psu = AsyncPowerSupply::open("/dev/hidraw5").await?;
// e.g. "Temperature: 42.25"
println!("Temperature: {:.2}", psu.temp1().await?);

pub async fn temp2(&mut self) -> Result<f32>[src]

Temperature reading in Celsius.

I do not know what this is a temperature reading of.

Example

use corsairmi::AsyncPowerSupply;

let mut psu = AsyncPowerSupply::open("/dev/hidraw5").await?;
// e.g. "Temperature: 34.25"
println!("Temperature: {:.2}", psu.temp2().await?);

pub async fn rpm(&mut self) -> Result<f32>[src]

Fan rotations per minute.

Example

use corsairmi::AsyncPowerSupply;

let mut psu = AsyncPowerSupply::open("/dev/hidraw5").await?;
// e.g. "RPM: 0.0"
println!("RPM: {:.1}", psu.rpm().await?);

pub async fn input_voltage(&mut self) -> Result<f32>[src]

Input voltage in volts.

Example

use corsairmi::AsyncPowerSupply;

let mut psu = AsyncPowerSupply::open("/dev/hidraw5").await?;
// e.g. "Input voltage: 115.0"
println!("Input voltage: {:.1}", psu.input_voltage().await?);

pub async fn input_power(&mut self) -> Result<f32>[src]

Input power in watts.

Example

use corsairmi::AsyncPowerSupply;

let mut psu = AsyncPowerSupply::open("/dev/hidraw5").await?;
// e.g. "Input power: 18.0"
println!("Input power: {:.1}", psu.input_power().await?);

pub async fn input_current(&mut self) -> Result<f32>[src]

Input current in amps.

This is derived from the input power and input voltage.

Example

use corsairmi::AsyncPowerSupply;

let mut psu = AsyncPowerSupply::open("/dev/hidraw5").await?;
// e.g. "Input current: 0.16"
println!("Input current: {:.2}", psu.input_current().await?);

pub async fn output_select(&mut self, rail: Rail) -> Result<()>[src]

Select the output rail to read from.

This should be called before calling AsyncPowerSupply::output_voltage, AsyncPowerSupply::output_current, or AsyncPowerSupply::output_power.

Example

use corsairmi::{AsyncPowerSupply, Rail, RAILS};

let mut psu = AsyncPowerSupply::open("/dev/hidraw5").await?;
for rail in RAILS.iter() {
    psu.output_select(*rail).await?;
    println!("{} output voltage: {}V", rail, psu.output_voltage().await?);
    println!("{} output current: {}A", rail, psu.output_current().await?);
    println!("{} output power: {}W", rail, psu.output_power().await?);
}

pub async fn output_voltage(&mut self) -> Result<f32>[src]

Get the output voltage in volts.

Call AsyncPowerSupply::output_select to select the rail to read from.

Example

use corsairmi::{AsyncPowerSupply, Rail};

let mut psu = AsyncPowerSupply::open("/dev/hidraw5").await?;
psu.output_select(Rail::Rail12v).await?;
println!("12V rail output voltage: {}V", psu.output_voltage().await?);

pub async fn output_current(&mut self) -> Result<f32>[src]

Get the output current in amps.

Call AsyncPowerSupply::output_select to select the rail to read from.

Example

use corsairmi::{AsyncPowerSupply, Rail};

let mut psu = AsyncPowerSupply::open("/dev/hidraw5").await?;
psu.output_select(Rail::Rail12v).await?;
println!("12V rail output current: {}A", psu.output_current().await?);

pub async fn output_power(&mut self) -> Result<f32>[src]

Get the output power in watts.

Call AsyncPowerSupply::output_select to select the rail to read from.

Example

use corsairmi::{AsyncPowerSupply, Rail};

let mut psu = AsyncPowerSupply::open("/dev/hidraw5").await?;
psu.output_select(Rail::Rail12v).await?;
println!("12V rail output power: {}W", psu.output_power().await?);

Trait Implementations

impl Debug for AsyncPowerSupply[src]

impl From<PowerSupply> for AsyncPowerSupply[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.