summaryrefslogtreecommitdiffstats
path: root/futures
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2021-01-15 21:07:37 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2021-01-15 21:07:37 +0100
commit9da0a3de54e8e7161d4a3405633bc574ce43eb2d (patch)
tree4ac1fc82ee22229abe94546a9824fe59af7bd6da /futures
parent803cc88483c310797911636562a98a6ebba33af7 (diff)
downloadiced-9da0a3de54e8e7161d4a3405633bc574ce43eb2d.tar.gz
iced-9da0a3de54e8e7161d4a3405633bc574ce43eb2d.tar.bz2
iced-9da0a3de54e8e7161d4a3405633bc574ce43eb2d.zip
Use `smol::Timer::interval` for `time::Every`
Diffstat (limited to 'futures')
-rw-r--r--futures/src/time.rs10
1 files changed, 1 insertions, 9 deletions
diff --git a/futures/src/time.rs b/futures/src/time.rs
index c11942d2..86b4a4e7 100644
--- a/futures/src/time.rs
+++ b/futures/src/time.rs
@@ -35,16 +35,8 @@ where
_input: futures::stream::BoxStream<'static, E>,
) -> futures::stream::BoxStream<'static, Self::Output> {
use futures::stream::StreamExt;
- use std::time::Instant;
- let duration = self.0;
-
- futures::stream::unfold(Instant::now(), move |last_tick| async move {
- let last_tick = smol::Timer::at(last_tick + duration).await;
-
- Some((last_tick, last_tick))
- })
- .boxed()
+ smol::Timer::interval(self.0).boxed()
}
}