summaryrefslogtreecommitdiffstats
path: root/native/src/subscription/events.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2022-01-17 21:46:17 +0700
committerLibravatar GitHub <noreply@github.com>2022-01-17 21:46:17 +0700
commit92a699b97dacd4c40316b67e20b6a3a777a1de64 (patch)
tree06ab57aaf4dada3a5b7cef6f331a22c47183ac5e /native/src/subscription/events.rs
parentb7bc169120d3447ead238e974007027a5152d341 (diff)
parent5ce8653fb51c035e0a6fe1ba7ab363018cdf107b (diff)
downloadiced-92a699b97dacd4c40316b67e20b6a3a777a1de64.tar.gz
iced-92a699b97dacd4c40316b67e20b6a3a777a1de64.tar.bz2
iced-92a699b97dacd4c40316b67e20b6a3a777a1de64.zip
Merge pull request #1198 from iced-rs/subscription-helpers
`websocket` example and helpers to create custom subscriptions
Diffstat (limited to 'native/src/subscription/events.rs')
-rw-r--r--native/src/subscription/events.rs35
1 files changed, 0 insertions, 35 deletions
diff --git a/native/src/subscription/events.rs b/native/src/subscription/events.rs
deleted file mode 100644
index ca143bb3..00000000
--- a/native/src/subscription/events.rs
+++ /dev/null
@@ -1,35 +0,0 @@
-use crate::event::{self, Event};
-use crate::subscription::{EventStream, Recipe};
-use crate::Hasher;
-use iced_futures::futures::future;
-use iced_futures::futures::StreamExt;
-use iced_futures::BoxStream;
-
-pub struct Events<Message> {
- pub(super) f: fn(Event, event::Status) -> Option<Message>,
-}
-
-impl<Message> Recipe<Hasher, (Event, event::Status)> for Events<Message>
-where
- Message: 'static + Send,
-{
- type Output = Message;
-
- fn hash(&self, state: &mut Hasher) {
- use std::hash::Hash;
-
- struct Marker;
- std::any::TypeId::of::<Marker>().hash(state);
- self.f.hash(state);
- }
-
- fn stream(
- self: Box<Self>,
- event_stream: EventStream,
- ) -> BoxStream<Self::Output> {
- let stream = event_stream.filter_map(move |(event, status)| {
- future::ready((self.f)(event, status))
- });
- iced_futures::boxed_stream(stream)
- }
-}