summaryrefslogtreecommitdiffstats
path: root/native/src/subscription
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-12-14 04:49:13 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-12-14 04:49:13 +0100
commit293314405f5b8d4003db5ef8f428e659ae36872d (patch)
tree0ae1f11d0347e53423568969397d8636e029c726 /native/src/subscription
parentba06d458d33d98bfaa5e66b3512ce7f063e8d7ba (diff)
downloadiced-293314405f5b8d4003db5ef8f428e659ae36872d.tar.gz
iced-293314405f5b8d4003db5ef8f428e659ae36872d.tar.bz2
iced-293314405f5b8d4003db5ef8f428e659ae36872d.zip
Make `iced_native` subscription input opaque
Diffstat (limited to 'native/src/subscription')
-rw-r--r--native/src/subscription/events.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/native/src/subscription/events.rs b/native/src/subscription/events.rs
new file mode 100644
index 00000000..b7301828
--- /dev/null
+++ b/native/src/subscription/events.rs
@@ -0,0 +1,23 @@
+use crate::{
+ subscription::{EventStream, Recipe},
+ Event, Hasher,
+};
+
+pub struct Events;
+
+impl Recipe<Hasher, EventStream> for Events {
+ type Output = Event;
+
+ fn hash(&self, state: &mut Hasher) {
+ use std::hash::Hash;
+
+ std::any::TypeId::of::<Self>().hash(state);
+ }
+
+ fn stream(
+ self: Box<Self>,
+ event_stream: EventStream,
+ ) -> futures::stream::BoxStream<'static, Self::Output> {
+ event_stream
+ }
+}