1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
use ComponentExt;
pub struct Component {
temperature: f32,
max: f32,
critical: Option<f32>,
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,
}
}
}
impl ComponentExt for Component {
fn get_temperature(&self) -> f32 {
self.temperature
}
fn get_max(&self) -> f32 {
self.max
}
fn get_critical(&self) -> Option<f32> {
self.critical
}
fn get_label(&self) -> &str {
&self.label
}
}
pub fn get_components() -> Vec<Component> {
Vec::new()
}