Enum gilrs::PowerInfo [−][src]
Expand description
State of device’s power supply.
Battery level is reported as integer between 0 and 100.
Example
use gilrs_core::PowerInfo;
match gilrs.gamepad(0).map(|g| g.power_info()) {
Some(PowerInfo::Discharging(lvl)) if lvl <= 10 => println!("Low battery level, you should \
plug your gamepad"),
_ => (),
};
Variants
Unknown
Failed to determine power status.
Wired
Device doesn’t have battery.
Discharging(u8)
Tuple Fields
0: u8
Device is running on the battery.
Charging(u8)
Tuple Fields
0: u8
Battery is charging.
Charged
Battery is charged.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for PowerInfo
impl UnwindSafe for PowerInfo
Blanket Implementations
Mutably borrows from an owned value. Read more