diff options
Diffstat (limited to 'futures/src/backend/native/tokio.rs')
-rw-r--r-- | futures/src/backend/native/tokio.rs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/futures/src/backend/native/tokio.rs b/futures/src/backend/native/tokio.rs index dd818bd1..4698a105 100644 --- a/futures/src/backend/native/tokio.rs +++ b/futures/src/backend/native/tokio.rs @@ -22,28 +22,26 @@ impl crate::Executor for Executor { pub mod time { //! Listen and react to time. + use crate::core::Hasher; use crate::subscription::{self, Subscription}; /// Returns a [`Subscription`] that produces messages at a set interval. /// /// The first message is produced after a `duration`, and then continues to /// produce more messages every `duration` after that. - pub fn every<H: std::hash::Hasher, E>( + pub fn every( duration: std::time::Duration, - ) -> Subscription<H, E, std::time::Instant> { + ) -> Subscription<std::time::Instant> { Subscription::from_recipe(Every(duration)) } #[derive(Debug)] struct Every(std::time::Duration); - impl<H, E> subscription::Recipe<H, E> for Every - where - H: std::hash::Hasher, - { + impl subscription::Recipe for Every { type Output = std::time::Instant; - fn hash(&self, state: &mut H) { + fn hash(&self, state: &mut Hasher) { use std::hash::Hash; std::any::TypeId::of::<Self>().hash(state); @@ -52,7 +50,7 @@ pub mod time { fn stream( self: Box<Self>, - _input: futures::stream::BoxStream<'static, E>, + _input: subscription::EventStream, ) -> futures::stream::BoxStream<'static, Self::Output> { use futures::stream::StreamExt; |