1use futures::{Async, Future};
6use std::time::Instant;
7use void::Void;
8use tokio;
9
10pub struct Delay {
11 inner: tokio::timer::Delay,
12}
13
14impl Delay {
15 pub fn new(at: Instant) -> Delay {
16 Delay {
17 inner: tokio::timer::Delay::new(at),
18 }
19 }
20
21 pub fn reset(&mut self, at: Instant) {
22 self.inner.reset(at)
23 }
24}
25
26impl Future for Delay {
27 type Item = ();
28 type Error = Void;
29
30 fn poll(&mut self) -> Result<Async<()>, Void> {
31 Ok(unwrap!(self.inner.poll()))
32 }
33}
34