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
Required Methods
fn hwmon_path(&self) -> &Path
fn hwmon_path(&self) -> &Path
Returns this sensor’s hwmon’s path.
Provided Methods
fn supported_read_sub_functions(&self) -> Vec<SensorSubFunctionType>
fn supported_read_sub_functions(&self) -> Vec<SensorSubFunctionType>
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.
fn subfunction_path(&self, sub_type: SensorSubFunctionType) -> PathBuf
fn subfunction_path(&self, sub_type: SensorSubFunctionType) -> PathBuf
Returns the path this sensor’s subfunction of the given type would have.