Mercurial > templog
diff rust/src/fridge.rs @ 611:f3e39e2107fd rust
still doesn't compile, improvements to TemplogError and tokio curl though
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 28 Feb 2017 22:58:47 +0800 |
parents | 7bda01659426 |
children | f153aec221be |
line wrap: on
line diff
--- a/rust/src/fridge.rs Thu Feb 23 23:27:09 2017 +0800 +++ b/rust/src/fridge.rs Tue Feb 28 22:58:47 2017 +0800 @@ -4,6 +4,7 @@ use std; use std::io; use std::mem; +use std::error::Error; use std::time::{Duration,Instant}; use futures::{Future,future,Sink,Stream}; @@ -38,7 +39,7 @@ impl Sink for Fridge { type SinkItem = Message; - type SinkError = std::io::Error; + type SinkError = TemplogError; fn start_send(&mut self, msg: Message) -> futures::StartSend<Self::SinkItem, Self::SinkError> { @@ -89,11 +90,11 @@ /// * invalid wort timeout /// All specified in next_wakeup() pub fn wakeups(&mut self) - -> Box<Stream<Item=Message, Error=io::Error>> { + -> Box<Stream<Item=Message, Error=TemplogError>> { mem::replace(&mut self.timeout_r, None) .expect("Fridge::wakeups() can only be called once") .map(|v| Message::Tick(v)) - .map_err(|_| io::Error::new(io::ErrorKind::Other, "Something wrong with watcher timeout channel")) + .map_err(|e| TemplogError::new("wakeups() receive failed")) .boxed() }