Mercurial > templog
comparison rust/src/params.rs @ 631:c57821a60e51 rust
rust work in progress ?
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sat, 06 Jul 2019 18:28:34 +0800 |
parents | 3e5e52d50af5 |
children | bde302def78e |
comparison
equal
deleted
inserted
replaced
630:7e9041534891 | 631:c57821a60e51 |
---|---|
139 p.write(|f| { | 139 p.write(|f| { |
140 serde_json::to_writer(f, params) | 140 serde_json::to_writer(f, params) |
141 }); | 141 }); |
142 } | 142 } |
143 | 143 |
144 #[async_stream(item = Params)] | |
145 pub fn stream(config: Config, handle: Handle) -> Result<(), TemplogError> { | 144 pub fn stream(config: Config, handle: Handle) -> Result<(), TemplogError> { |
146 let rcself = Rc::new(ParamWaiter::new(config, handle)); | 145 let rcself = Rc::new(ParamWaiter::new(config, handle)); |
147 | 146 |
148 let dur = Duration::from_millis(4000); | 147 let dur = Duration::from_millis(4000); |
149 #[async] | |
150 for _ in Interval::new(dur, &rcself.handle).unwrap() { | 148 for _ in Interval::new(dur, &rcself.handle).unwrap() { |
151 // fetch params | 149 // fetch params |
152 // TODO - skip if inflight. | 150 // TODO - skip if inflight. |
153 let r = await!(rcself.make_request()).map_err(|e| TemplogError::new_hyper("response", e))?; | 151 let r = await!(rcself.make_request()).map_err(|e| TemplogError::new_hyper("response", e))?; |
154 let status = r.status(); | 152 let status = r.status(); |