Added missing functions to structs
This commit is contained in:
24
src/lib.rs
24
src/lib.rs
@@ -26,6 +26,14 @@ impl FanState {
|
||||
pub fn new(speed: FanSpeed, manual: bool) -> Self {
|
||||
Self { speed, manual }
|
||||
}
|
||||
|
||||
pub fn speed(&self) -> FanSpeed {
|
||||
self.speed
|
||||
}
|
||||
|
||||
pub fn manual(&self) -> bool {
|
||||
self.manual
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
@@ -34,6 +42,10 @@ pub struct SetFanSpeed {
|
||||
}
|
||||
|
||||
impl SetFanSpeed {
|
||||
pub fn new(speed: FanSpeed) -> Self {
|
||||
Self { speed }
|
||||
}
|
||||
|
||||
pub fn speed(&self) -> FanSpeed {
|
||||
self.speed
|
||||
}
|
||||
@@ -54,4 +66,16 @@ impl SensorData {
|
||||
pressure: measurements.pressure,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn temperature(&self) -> f32 {
|
||||
self.temperature
|
||||
}
|
||||
|
||||
pub fn humidity(&self) -> f32 {
|
||||
self.humidity
|
||||
}
|
||||
|
||||
pub fn pressure(&self) -> f32 {
|
||||
self.pressure
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user