Trait humidity_core::sensors::Sensor

source ·
pub trait Sensor: Serializable + Deserializable {
    // Required methods
    fn low(&self) -> u16;
    fn high(&self) -> u16;

    // Provided method
    fn percentage(&self, value: u16) -> f32 { ... }
}
Expand description

Defines common behaviour for all sensors, such as getting the calibrated low and high values, and provides a function to compute where a value fits within the calibrated boundaries.

Required Methods§

source

fn low(&self) -> u16

Returns the calibrated low reading.

source

fn high(&self) -> u16

Returns the calibrated high reading.

Provided Methods§

source

fn percentage(&self, value: u16) -> f32

Given a value, returns the percentage it falls within the calibrated boundaries.

Object Safety§

This trait is not object safe.

Implementors§