Enum gilrs_core::PowerInfo
source · [−]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 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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more