pub struct Component {
pub temperature: f32,
pub max: f32,
pub critical: Option<f32>,
pub label: String,
}
impl Component {
pub fn new(label: String, max: Option<f32>, critical: Option<f32>) -> Component {
Component {
temperature: 0f32,
label: label,
max: max.unwrap_or(0.0),
critical: critical,
}
}
}
pub fn update_component(comp: &mut Component, temperature: f32) {
comp.temperature = temperature;
if comp.temperature > comp.max {
comp.max = comp.temperature;
}
}