summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-12-14 01:13:01 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-12-14 01:13:01 +0100
commitc688452d7beb1b17ef8416fc101f8868767fc457 (patch)
treec2ef229276dcf9b4040bbeb70d048120f9738106
parent69ed631d449e74b38054aa052c620368cb65c72c (diff)
downloadiced-c688452d7beb1b17ef8416fc101f8868767fc457.tar.gz
iced-c688452d7beb1b17ef8416fc101f8868767fc457.tar.bz2
iced-c688452d7beb1b17ef8416fc101f8868767fc457.zip
Consume `Recipe` when building a `Stream`
-rw-r--r--core/src/subscription.rs4
-rw-r--r--examples/events.rs2
-rw-r--r--examples/stopwatch.rs2
-rw-r--r--winit/src/application.rs1
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<Hasher: std::hash::Hasher, Input> {
fn hash(&self, state: &mut Hasher);
fn stream(
- &self,
+ self: Box<Self>,
input: Input,
) -> futures::stream::BoxStream<'static, Self::Output>;
}
@@ -110,7 +110,7 @@ where
}
fn stream(
- &self,
+ self: Box<Self>,
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<Self>,
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<Self>,
_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()));