summaryrefslogtreecommitdiffstats
path: root/futures/src/time.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-11-25 03:06:24 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-11-25 03:06:24 +0100
commit782dd2f5222bfef5e12aa576a821da21126505b7 (patch)
treeef43d15531134d4c92dedca14682d70d0c614a00 /futures/src/time.rs
parenta4ad1b297e97d6c3efc196681822f127efc954cc (diff)
downloadiced-782dd2f5222bfef5e12aa576a821da21126505b7.tar.gz
iced-782dd2f5222bfef5e12aa576a821da21126505b7.tar.bz2
iced-782dd2f5222bfef5e12aa576a821da21126505b7.zip
Introduce `tokio_old` feature
This feature allows users to rely on the `0.2` version of `tokio` while the async ecosystem upgrades to the latest version.
Diffstat (limited to '')
-rw-r--r--futures/src/time.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/futures/src/time.rs b/futures/src/time.rs
index e87b4a83..ec007d88 100644
--- a/futures/src/time.rs
+++ b/futures/src/time.rs
@@ -41,7 +41,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 +64,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)