pub trait Sensor {
    type Value: Raw + Display;

    fn base(&self) -> &'static str;
    fn index(&self) -> u16;
    fn hwmon_path(&self) -> &Path;

    fn supported_read_sub_functions(&self) -> Vec<SensorSubFunctionType> { ... }
    fn name(&self) -> String { ... }
    fn read_raw(&self, sub_type: SensorSubFunctionType) -> Result<String, Error> { ... }
    fn subfunction_path(&self, sub_type: SensorSubFunctionType) -> PathBuf { ... }
}
Expand description

Base trait that all sensors must implement. It contains the functionality to get a sensor’s name, index or supported subfunctions.

Required Associated Types

Type used by the sensor for measurements.

Required Methods

Returns this sensor’s base like “temp” or “fan”.

Returns this sensor’s index.

Returns this sensor’s hwmon’s path.

Provided Methods

Returns a list of all readable subfunction types supported by this sensor.

If this sensor has a label, its contents are returned. Otherwise a plain sensor descriptor is returned.

Reads this sensor’s subfunction with the given type and returns its value as a raw string. You should usually prefer the specialized read functions like read_input, because they automatically convert the read value to the right type. Returns an error, if this sensor doesn’t support the subtype.

Returns the path this sensor’s subfunction of the given type would have.

Implementors