comparison rust/src/fridge.rs @ 626:efcbe0d3afd6 rust

fix to work with hyper
author Matt Johnston <matt@ucc.asn.au>
date Wed, 06 Dec 2017 00:09:45 +0800
parents 8136a6b99866
children e1b5938de122
comparison
equal deleted inserted replaced
625:8152ef251dbb 626:efcbe0d3afd6
1 extern crate futures; 1 extern crate futures;
2 extern crate tokio_core; 2 extern crate tokio_core;
3 #[cfg(linux)] 3 #[cfg(target_os = "linux")]
4 extern crate sysfs_gpio; 4 extern crate sysfs_gpio;
5 5
6 use std; 6 use std;
7 use std::io; 7 use std::io;
8 use std::mem; 8 use std::mem;
12 use futures::{Future,future,Sink,Stream}; 12 use futures::{Future,future,Sink,Stream};
13 use tokio_core::reactor::{Timeout,Handle}; 13 use tokio_core::reactor::{Timeout,Handle};
14 use futures::sync::{mpsc}; 14 use futures::sync::{mpsc};
15 15
16 #[cfg(target_os = "linux")] 16 #[cfg(target_os = "linux")]
17 use sysfs_gpio::{Direction, Pin}; 17 use self::sysfs_gpio::{Direction, Pin};
18 18
19 use config::Config; 19 use config::Config;
20 use params::Params; 20 use params::Params;
21 use types::*; 21 use types::*;
22 22
136 /// * minimum fridge-off time 136 /// * minimum fridge-off time
137 /// * invalid wort timeout 137 /// * invalid wort timeout
138 /// All specified in next_wakeup() 138 /// All specified in next_wakeup()
139 pub fn wakeups(&mut self) 139 pub fn wakeups(&mut self)
140 -> Box<Stream<Item=Message, Error=TemplogError>> { 140 -> Box<Stream<Item=Message, Error=TemplogError>> {
141 mem::replace(&mut self.timeout_r, None) 141 Box::new(mem::replace(&mut self.timeout_r, None)
142 .expect("Fridge::wakeups() can only be called once") 142 .expect("Fridge::wakeups() can only be called once")
143 .map(|v| Message::Tick(v)) 143 .map(|v| Message::Tick(v))
144 .map_err(|e| TemplogError::new("wakeups() receive failed")) 144 .map_err(|e| TemplogError::new("wakeups() receive failed")))
145 .boxed()
146 } 145 }
147 146
148 fn turn_off(&mut self) { 147 fn turn_off(&mut self) {
149 info!("Turning fridge off"); 148 info!("Turning fridge off");
150 self.turn(false); 149 self.turn(false);