From 43414bbdfb080b7aa3c702d944cc9d0c9c0fd14b Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sun, 5 Mar 2023 05:37:23 +0100 Subject: Fix `wasm-bindgen` backend in `iced_futures` --- futures/src/backend/wasm/wasm_bindgen.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'futures') diff --git a/futures/src/backend/wasm/wasm_bindgen.rs b/futures/src/backend/wasm/wasm_bindgen.rs index b726501a..2666f1b4 100644 --- a/futures/src/backend/wasm/wasm_bindgen.rs +++ b/futures/src/backend/wasm/wasm_bindgen.rs @@ -16,6 +16,7 @@ impl crate::Executor for Executor { pub mod time { //! Listen and react to time. + use crate::core::Hasher; use crate::subscription::{self, Subscription}; use crate::BoxStream; @@ -23,22 +24,19 @@ pub mod time { /// /// The first message is produced after a `duration`, and then continues to /// produce more messages every `duration` after that. - pub fn every( + pub fn every( duration: std::time::Duration, - ) -> Subscription { + ) -> Subscription { Subscription::from_recipe(Every(duration)) } #[derive(Debug)] struct Every(std::time::Duration); - impl subscription::Recipe for Every - where - H: std::hash::Hasher, - { + impl subscription::Recipe for Every { type Output = wasm_timer::Instant; - fn hash(&self, state: &mut H) { + fn hash(&self, state: &mut Hasher) { use std::hash::Hash; std::any::TypeId::of::().hash(state); @@ -47,7 +45,7 @@ pub mod time { fn stream( self: Box, - _input: BoxStream, + _input: subscription::EventStream, ) -> BoxStream { use futures::stream::StreamExt; -- cgit