diff options
author | 2019-12-16 21:38:56 +0100 | |
---|---|---|
committer | 2019-12-16 21:38:56 +0100 | |
commit | 0f2e20f5e5b1f0658ab4e6cbe6fdda9ca97f2b36 (patch) | |
tree | 6b4c601bfa0ced1e003f597d7f485be7c108e12c /native/src/subscription/events.rs | |
parent | 3702b109977a249247a0f1be40e57bec2cbaa4e3 (diff) | |
parent | 430ab6e44432d044f8444575053d97651f0f7d20 (diff) | |
download | iced-0f2e20f5e5b1f0658ab4e6cbe6fdda9ca97f2b36.tar.gz iced-0f2e20f5e5b1f0658ab4e6cbe6fdda9ca97f2b36.tar.bz2 iced-0f2e20f5e5b1f0658ab4e6cbe6fdda9ca97f2b36.zip |
Merge pull request #122 from hecrj/feature/event-subscriptions
Event subscriptions
Diffstat (limited to 'native/src/subscription/events.rs')
-rw-r--r-- | native/src/subscription/events.rs | 23 |
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 + } +} |