Enum gilrs_core::PowerInfo
source · 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§
impl Copy for PowerInfo
impl Eq for PowerInfo
impl StructuralPartialEq for PowerInfo
Auto Trait Implementations§
impl Freeze for PowerInfo
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)