diff --git a/Cargo.toml b/Cargo.toml index bc19ad1..0a1e395 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ edition = "2018" [dependencies] tokio = "0.1.14" futures = "0.1.25" -tokio-timer = "0.2.8" +futures-timer = "0.1" [build-dependencies] skeptic = "0.13" diff --git a/src/lib.rs b/src/lib.rs index dd3f660..b461621 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,11 +1,11 @@ use std::mem; +use std::io; use std::prelude::v1::*; -use std::time::{Duration, Instant}; +use std::time::Duration; use futures::stream::{Fuse, Stream}; use futures::{Async, Future, Poll}; -use tokio::timer; -use tokio::timer::Delay; +use futures_timer::Delay; /// An adaptor that chunks up elements in a vector. /// @@ -39,7 +39,7 @@ enum Kind { Inner(T), /// Timer returned an error. - Timer(timer::Error), + Timer(io::Error), } impl Chunks @@ -114,7 +114,7 @@ where // the full one. Ok(Async::Ready(Some(item))) => { if self.items.is_empty() { - self.clock = Some(Delay::new(Instant::now() + self.duration)); + self.clock = Some(Delay::new(self.duration)); } self.items.push(item); if self.items.len() >= cap { @@ -236,7 +236,7 @@ mod tests { let iter = vec![5].into_iter(); let stream1 = stream::iter_ok::<_, io::Error>(iter).and_then(|n| { - Delay::new(Instant::now() + Duration::from_millis(300)) + Delay::new(Duration::from_millis(300)) .and_then(move |_| Ok(n)) .map_err(|e| io::Error::new(io::ErrorKind::TimedOut, e)) });