pub enum BatteryLevel {
OnBattery(u8),
OnExternalPower,
}
Expand description
Information about the battery level gather from a device with
MtpDevice::battery_level
.
§Example
let (level, max_level) = mtp_device.battery_level().expect("Failed to get battery level");
match level {
BatteryLevel::OnBattery(level) => println!("Using battery, current level {}", level),
BatteryLevel::OnExternalPower => println!("Using external power, connected to AC"),
}
Variants§
OnBattery(u8)
The device is currently on battery.
OnExternalPower
The device is currently on external power.
Trait Implementations§
Source§impl Clone for BatteryLevel
impl Clone for BatteryLevel
Source§fn clone(&self) -> BatteryLevel
fn clone(&self) -> BatteryLevel
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for BatteryLevel
impl Debug for BatteryLevel
impl Copy for BatteryLevel
Auto Trait Implementations§
impl Freeze for BatteryLevel
impl RefUnwindSafe for BatteryLevel
impl Send for BatteryLevel
impl Sync for BatteryLevel
impl Unpin for BatteryLevel
impl UnwindSafe for BatteryLevel
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