pub enum PowerInfo {
Unknown,
Wired,
Discharging(u8),
Charging(u8),
Charged,
}
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)
Device is running on the battery.
Charging(u8)
Battery is charging.
Charged
Battery is charged.
Trait Implementations§
source§impl PartialEq for PowerInfo
impl PartialEq for PowerInfo
impl Copy for PowerInfo
impl Eq for PowerInfo
impl StructuralEq for PowerInfo
impl StructuralPartialEq for PowerInfo
Auto Trait Implementations§
impl RefUnwindSafe for PowerInfo
impl Send for PowerInfo
impl Sync for PowerInfo
impl Unpin for PowerInfo
impl UnwindSafe for PowerInfo
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more