pub struct LinuxSysfsReader { /* private fields */ }Expand description
Reads battery state from the Linux sysfs power-supply interface.
Scans /sys/class/power_supply/ (or an override root for tests) for the
first entry whose type file contains Battery. Reads capacity,
status, and optionally energy_now + power_now (or charge_now +
current_now) to compute BatteryReading::time_to_empty.
Implementations§
Trait Implementations§
Source§impl BatteryReader for LinuxSysfsReader
impl BatteryReader for LinuxSysfsReader
Source§fn read(&self) -> Result<BatteryReading, BatteryError>
fn read(&self) -> Result<BatteryReading, BatteryError>
Read the current battery state.
Auto Trait Implementations§
impl Freeze for LinuxSysfsReader
impl RefUnwindSafe for LinuxSysfsReader
impl Send for LinuxSysfsReader
impl Sync for LinuxSysfsReader
impl Unpin for LinuxSysfsReader
impl UnsafeUnpin for LinuxSysfsReader
impl UnwindSafe for LinuxSysfsReader
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more