summaryrefslogtreecommitdiffstats
path: root/futures/src/subscription.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-06-04 23:20:33 +0200
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-06-10 22:03:46 +0200
commite400f972c1fe6fa4f70f8cfe559ded680e6cf740 (patch)
tree3f026bfdf489c367ff007b6513752c8060014a4d /futures/src/subscription.rs
parent49affc44ff57ad879a73d9b4d329863d6f4b1d2c (diff)
downloadiced-e400f972c1fe6fa4f70f8cfe559ded680e6cf740.tar.gz
iced-e400f972c1fe6fa4f70f8cfe559ded680e6cf740.tar.bz2
iced-e400f972c1fe6fa4f70f8cfe559ded680e6cf740.zip
Introduce `window::Id` to `Event` subscriptions
And remove `window::Id` from `Event` altogether.
Diffstat (limited to 'futures/src/subscription.rs')
-rw-r--r--futures/src/subscription.rs11
1 files changed, 7 insertions, 4 deletions
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<I, F, Message>(id: I, f: F) -> Subscription<Message>
where
I: Hash + 'static,
- F: Fn(Event, event::Status) -> Option<Message> + MaybeSend + 'static,
+ F: Fn(Event, event::Status, window::Id) -> Option<Message>
+ + 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))
})
},
})