Update tokio to 1.0

This commit is contained in:
Yusuf Bera Ertan 2021-01-04 22:58:39 +03:00 committed by Héctor Ramón Jiménez
parent 2665860b4d
commit 50452e62b4
3 changed files with 19 additions and 6 deletions

View file

@ -67,8 +67,20 @@ where
let start = tokio::time::Instant::now() + self.0;
tokio::time::interval_at(start, self.0)
.map(|_| std::time::Instant::now())
.boxed()
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)
};
stream.map(|_| std::time::Instant::now()).boxed()
}
}