pub trait Device {
// Required methods
fn latest_measurement(
&self,
) -> impl Future<Output = Result<Option<Measurement>, Error>> + Send;
fn latest_successful_measurement(
&self,
) -> impl Future<Output = Result<Option<SuccessfulMeasurement>, Error>> + Send;
fn measurement_history(
&self,
) -> impl Future<Output = Result<Vec<Measurement>, Error>> + Send;
fn system_status(
&self,
) -> impl Future<Output = Result<SystemStatus, Error>> + Send;
}Expand description
represents an UPW Sensor v1 device
see device for documentation
Required Methods§
Sourcefn latest_measurement(
&self,
) -> impl Future<Output = Result<Option<Measurement>, Error>> + Send
fn latest_measurement( &self, ) -> impl Future<Output = Result<Option<Measurement>, Error>> + Send
returns the latest measurement available or None if the sensor has just booted and not
read anything yet
Calling this funtion will not trigger a new measurement. It will merely fetch the latest measurement.
Sourcefn latest_successful_measurement(
&self,
) -> impl Future<Output = Result<Option<SuccessfulMeasurement>, Error>> + Send
fn latest_successful_measurement( &self, ) -> impl Future<Output = Result<Option<SuccessfulMeasurement>, Error>> + Send
returns the latest successfull measurement available or None if the sensor has never read
a successful measurement since it last booted
Calling this funtion will not trigger a new measurement. It will merely fetch the latest measurement.
Sourcefn measurement_history(
&self,
) -> impl Future<Output = Result<Vec<Measurement>, Error>> + Send
fn measurement_history( &self, ) -> impl Future<Output = Result<Vec<Measurement>, Error>> + Send
returns the entire history of Measurements since the device booted. This includes
successful and erroneous measurements. The list may be empty if the device just booted and
has not performed any measurements yet.
Sourcefn system_status(
&self,
) -> impl Future<Output = Result<SystemStatus, Error>> + Send
fn system_status( &self, ) -> impl Future<Output = Result<SystemStatus, Error>> + Send
returns the device’s current system status
see SystemStatus for more information
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.