diff options
Diffstat (limited to 'futures/src/time.rs')
-rw-r--r-- | futures/src/time.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/futures/src/time.rs b/futures/src/time.rs index e87b4a83..5e9ea436 100644 --- a/futures/src/time.rs +++ b/futures/src/time.rs @@ -5,8 +5,6 @@ use crate::subscription::{self, Subscription}; /// /// The first message is produced after a `duration`, and then continues to /// produce more messages every `duration` after that. -/// -/// [`Subscription`]: ../subscription/struct.Subscription.html pub fn every<H: std::hash::Hasher, E>( duration: std::time::Duration, ) -> Subscription<H, E, std::time::Instant> { @@ -41,7 +39,10 @@ where } } -#[cfg(all(feature = "tokio", not(feature = "async-std")))] +#[cfg(all( + any(feature = "tokio", feature = "tokio_old"), + not(feature = "async-std") +))] impl<H, E> subscription::Recipe<H, E> for Every where H: std::hash::Hasher, @@ -61,6 +62,9 @@ where ) -> futures::stream::BoxStream<'static, Self::Output> { use futures::stream::StreamExt; + #[cfg(feature = "tokio_old")] + use tokio_old as tokio; + let start = tokio::time::Instant::now() + self.0; tokio::time::interval_at(start, self.0) |