Skip to main content

Sensor

Trait Sensor 

Source
pub trait Sensor {
    type Reading;

    // Required method
    async fn read(&mut self) -> Result<Self::Reading>;
}
Expand description

A source of typed readings, such as a thermometer, GPS receiver, or lidar.

Required Associated Types§

Source

type Reading

The value produced by a single read, for example a temperature or a fix.

Required Methods§

Source

async fn read(&mut self) -> Result<Self::Reading>

Takes a single reading from the sensor.

§Returns

The next Reading sampled from the sensor.

§Errors

Returns Error::Io if the sensor cannot be read, or Error::Closed if the sensor has been disconnected.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§