From e400f972c1fe6fa4f70f8cfe559ded680e6cf740 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 4 Jun 2024 23:20:33 +0200 Subject: Introduce `window::Id` to `Event` subscriptions And remove `window::Id` from `Event` altogether. --- futures/src/subscription.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'futures/src/subscription.rs') diff --git a/futures/src/subscription.rs b/futures/src/subscription.rs index 93e35608..79cea6ed 100644 --- a/futures/src/subscription.rs +++ b/futures/src/subscription.rs @@ -4,6 +4,7 @@ mod tracker; pub use tracker::Tracker; use crate::core::event::{self, Event}; +use crate::core::window; use crate::futures::{Future, Stream}; use crate::{BoxStream, MaybeSend}; @@ -15,7 +16,7 @@ use std::hash::Hash; /// A stream of runtime events. /// /// It is the input of a [`Subscription`]. -pub type EventStream = BoxStream<(Event, event::Status)>; +pub type EventStream = BoxStream<(Event, event::Status, window::Id)>; /// The hasher used for identifying subscriptions. pub type Hasher = rustc_hash::FxHasher; @@ -289,7 +290,9 @@ where pub(crate) fn filter_map(id: I, f: F) -> Subscription where I: Hash + 'static, - F: Fn(Event, event::Status) -> Option + MaybeSend + 'static, + F: Fn(Event, event::Status, window::Id) -> Option + + MaybeSend + + 'static, Message: 'static + MaybeSend, { Subscription::from_recipe(Runner { @@ -298,8 +301,8 @@ where use futures::future; use futures::stream::StreamExt; - events.filter_map(move |(event, status)| { - future::ready(f(event, status)) + events.filter_map(move |(event, status, window)| { + future::ready(f(event, status, window)) }) }, }) -- cgit