Fix wasm-bindgen backend in iced_futures
This commit is contained in:
parent
cfb8abb6f5
commit
43414bbdfb
1 changed files with 6 additions and 8 deletions
|
|
@ -16,6 +16,7 @@ impl crate::Executor for Executor {
|
||||||
|
|
||||||
pub mod time {
|
pub mod time {
|
||||||
//! Listen and react to time.
|
//! Listen and react to time.
|
||||||
|
use crate::core::Hasher;
|
||||||
use crate::subscription::{self, Subscription};
|
use crate::subscription::{self, Subscription};
|
||||||
use crate::BoxStream;
|
use crate::BoxStream;
|
||||||
|
|
||||||
|
|
@ -23,22 +24,19 @@ pub mod time {
|
||||||
///
|
///
|
||||||
/// The first message is produced after a `duration`, and then continues to
|
/// The first message is produced after a `duration`, and then continues to
|
||||||
/// produce more messages every `duration` after that.
|
/// produce more messages every `duration` after that.
|
||||||
pub fn every<H: std::hash::Hasher, E>(
|
pub fn every(
|
||||||
duration: std::time::Duration,
|
duration: std::time::Duration,
|
||||||
) -> Subscription<H, E, wasm_timer::Instant> {
|
) -> Subscription<wasm_timer::Instant> {
|
||||||
Subscription::from_recipe(Every(duration))
|
Subscription::from_recipe(Every(duration))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct Every(std::time::Duration);
|
struct Every(std::time::Duration);
|
||||||
|
|
||||||
impl<H, E> subscription::Recipe<H, E> for Every
|
impl subscription::Recipe for Every {
|
||||||
where
|
|
||||||
H: std::hash::Hasher,
|
|
||||||
{
|
|
||||||
type Output = wasm_timer::Instant;
|
type Output = wasm_timer::Instant;
|
||||||
|
|
||||||
fn hash(&self, state: &mut H) {
|
fn hash(&self, state: &mut Hasher) {
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
|
|
||||||
std::any::TypeId::of::<Self>().hash(state);
|
std::any::TypeId::of::<Self>().hash(state);
|
||||||
|
|
@ -47,7 +45,7 @@ pub mod time {
|
||||||
|
|
||||||
fn stream(
|
fn stream(
|
||||||
self: Box<Self>,
|
self: Box<Self>,
|
||||||
_input: BoxStream<E>,
|
_input: subscription::EventStream,
|
||||||
) -> BoxStream<Self::Output> {
|
) -> BoxStream<Self::Output> {
|
||||||
use futures::stream::StreamExt;
|
use futures::stream::StreamExt;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue