pub trait BatteryReader: Send + Sync {
// Required method
fn read(&self) -> Result<BatteryReading, BatteryError>;
}Expand description
Abstraction over battery hardware.
Implement this trait to provide battery readings from a real or simulated
source. Implementations must be Send + Sync so they can be shared across
threads without restriction.
Required Methods§
Sourcefn read(&self) -> Result<BatteryReading, BatteryError>
fn read(&self) -> Result<BatteryReading, BatteryError>
Read the current battery state.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".