Use iced_futures utilities to make native work under wasm32 target.

This commit is contained in:
Tanner Rogalsky 2021-11-14 11:04:20 -05:00
parent 55eaeceec8
commit 24d7d4740f
2 changed files with 6 additions and 7 deletions

View file

@ -1,7 +1,7 @@
//! Listen to external events in your application.
use crate::event::{self, Event};
use crate::Hasher;
use iced_futures::futures::stream::BoxStream;
use iced_futures::BoxStream;
/// A request to listen to external events.
///
@ -21,7 +21,7 @@ pub type Subscription<T> =
/// A stream of runtime events.
///
/// It is the input of a [`Subscription`] in the native runtime.
pub type EventStream = BoxStream<'static, (Event, event::Status)>;
pub type EventStream = BoxStream<(Event, event::Status)>;
/// A native [`Subscription`] tracker.
pub type Tracker =

View file

@ -27,10 +27,9 @@ where
self: Box<Self>,
event_stream: EventStream,
) -> BoxStream<Self::Output> {
event_stream
.filter_map(move |(event, status)| {
future::ready((self.f)(event, status))
})
.boxed()
let stream = event_stream.filter_map(move |(event, status)| {
future::ready((self.f)(event, status))
});
iced_futures::boxed_stream(stream)
}
}