diff options
author | 2022-01-12 20:03:18 +0700 | |
---|---|---|
committer | 2022-01-12 20:03:18 +0700 | |
commit | 67f878b8906a7ad2bd708e7c2bc4aa9f1d232d0e (patch) | |
tree | 230b0d70d4c0e11591f493beaec8eac77d59cf7c /futures/src/time.rs | |
parent | 1a31aefab401712e44cd613fc1337ab90579d926 (diff) | |
download | iced-67f878b8906a7ad2bd708e7c2bc4aa9f1d232d0e.tar.gz iced-67f878b8906a7ad2bd708e7c2bc4aa9f1d232d0e.tar.bz2 iced-67f878b8906a7ad2bd708e7c2bc4aa9f1d232d0e.zip |
Remove support for old `tokio` crate
Diffstat (limited to '')
-rw-r--r-- | futures/src/time.rs | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/futures/src/time.rs b/futures/src/time.rs index 86b4a4e7..0ece6f04 100644 --- a/futures/src/time.rs +++ b/futures/src/time.rs @@ -14,7 +14,7 @@ pub fn every<H: std::hash::Hasher, E>( struct Every(std::time::Duration); #[cfg(all( - not(any(feature = "tokio_old", feature = "tokio", feature = "async-std")), + not(any(feature = "tokio", feature = "async-std")), feature = "smol" ))] impl<H, E> subscription::Recipe<H, E> for Every @@ -67,7 +67,7 @@ where } #[cfg(all( - any(feature = "tokio", feature = "tokio_old"), + feature = "tokio", not(any(feature = "async-std", feature = "smol")) ))] impl<H, E> subscription::Recipe<H, E> for Every @@ -89,23 +89,15 @@ 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; let stream = { - #[cfg(feature = "tokio")] - { - futures::stream::unfold( - tokio::time::interval_at(start, self.0), - |mut interval| async move { - Some((interval.tick().await, interval)) - }, - ) - } - #[cfg(feature = "tokio_old")] - tokio::time::interval_at(start, self.0) + futures::stream::unfold( + tokio::time::interval_at(start, self.0), + |mut interval| async move { + Some((interval.tick().await, interval)) + }, + ) }; stream.map(tokio::time::Instant::into_std).boxed() |