From c688452d7beb1b17ef8416fc101f8868767fc457 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 14 Dec 2019 01:13:01 +0100 Subject: Consume `Recipe` when building a `Stream` --- core/src/subscription.rs | 4 ++-- examples/events.rs | 2 +- examples/stopwatch.rs | 2 +- winit/src/application.rs | 1 + 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/core/src/subscription.rs b/core/src/subscription.rs index e9559f3c..3ba5e629 100644 --- a/core/src/subscription.rs +++ b/core/src/subscription.rs @@ -75,7 +75,7 @@ pub trait Recipe { fn hash(&self, state: &mut Hasher); fn stream( - &self, + self: Box, input: Input, ) -> futures::stream::BoxStream<'static, Self::Output>; } @@ -110,7 +110,7 @@ where } fn stream( - &self, + self: Box, input: I, ) -> futures::stream::BoxStream<'static, Self::Output> { use futures::StreamExt; diff --git a/examples/events.rs b/examples/events.rs index 0a3d3ed3..f9e606d8 100644 --- a/examples/events.rs +++ b/examples/events.rs @@ -108,7 +108,7 @@ mod events { } fn stream( - &self, + self: Box, input: iced_native::subscription::Input, ) -> futures::stream::BoxStream<'static, Self::Output> { use futures::StreamExt; diff --git a/examples/stopwatch.rs b/examples/stopwatch.rs index 4f931278..b902baae 100644 --- a/examples/stopwatch.rs +++ b/examples/stopwatch.rs @@ -167,7 +167,7 @@ mod time { } fn stream( - &self, + self: Box, _input: Input, ) -> futures::stream::BoxStream<'static, Self::Output> { use futures::stream::StreamExt; diff --git a/winit/src/application.rs b/winit/src/application.rs index fb31c44f..67a035f7 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -470,6 +470,7 @@ impl Subscriptions { let stream = recipe.stream(event_receiver); + // TODO: Find out how to avoid using a mutex here let proxy = std::sync::Arc::new(std::sync::Mutex::new(proxy.clone())); -- cgit