Mercurial > templog
comparison rust/src/types.rs @ 593:bf138339d20a rust
fiddling with timeouts and closures
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 27 Dec 2016 00:51:28 +0800 |
parents | 03b48ec0bb03 |
children | aff50ee77252 |
comparison
equal
deleted
inserted
replaced
592:03b48ec0bb03 | 593:bf138339d20a |
---|---|
1 #[derive(RustcDecodable, RustcEncodable, Debug)] | 1 #[derive(RustcDecodable, RustcEncodable, Debug, Clone)] |
2 pub struct Params { | 2 pub struct Params { |
3 pub fridge_setpoint: f32, | 3 pub fridge_setpoint: f32, |
4 pub fridge_difference: f32, | 4 pub fridge_difference: f32, |
5 pub overshoot_delay: u32, | 5 pub overshoot_delay: u32, |
6 pub overshoot_factor: f32, | 6 pub overshoot_factor: f32, |
53 pub fn new_none(name: String) -> Reading { | 53 pub fn new_none(name: String) -> Reading { |
54 Reading { name: name, value: None } | 54 Reading { name: name, value: None } |
55 } | 55 } |
56 } | 56 } |
57 | 57 |
58 #[derive(Debug)] | |
58 pub struct Readings { | 59 pub struct Readings { |
59 temps: Vec<Vec<Reading>>, | 60 temps: Vec<Vec<Reading>>, |
60 } | 61 } |
61 | 62 |
62 impl Readings { | 63 impl Readings { |
63 pub fn new() -> Readings { | 64 pub fn new() -> Readings { |
64 Readings { | 65 Readings { |
65 temps: Vec::new(), | 66 temps: Vec::new(), |
66 } | 67 } |
67 } | 68 } |
69 | |
70 pub fn push(&mut self, vals: Vec<Reading>) { | |
71 self.temps.push(vals); | |
72 } | |
73 | |
68 pub fn fridge(&self) -> Option<f32> { | 74 pub fn fridge(&self) -> Option<f32> { |
69 unimplemented!(); | 75 unimplemented!(); |
70 } | 76 } |
71 | 77 |
72 pub fn wort(&self) -> Option<f32> { | 78 pub fn wort(&self) -> Option<f32> { |