Consume Recipe when building a Stream
This commit is contained in:
parent
69ed631d44
commit
c688452d7b
@ -75,7 +75,7 @@ pub trait Recipe<Hasher: std::hash::Hasher, Input> {
|
|||||||
fn hash(&self, state: &mut Hasher);
|
fn hash(&self, state: &mut Hasher);
|
||||||
|
|
||||||
fn stream(
|
fn stream(
|
||||||
&self,
|
self: Box<Self>,
|
||||||
input: Input,
|
input: Input,
|
||||||
) -> futures::stream::BoxStream<'static, Self::Output>;
|
) -> futures::stream::BoxStream<'static, Self::Output>;
|
||||||
}
|
}
|
||||||
@ -110,7 +110,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn stream(
|
fn stream(
|
||||||
&self,
|
self: Box<Self>,
|
||||||
input: I,
|
input: I,
|
||||||
) -> futures::stream::BoxStream<'static, Self::Output> {
|
) -> futures::stream::BoxStream<'static, Self::Output> {
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
|
|||||||
@ -108,7 +108,7 @@ mod events {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn stream(
|
fn stream(
|
||||||
&self,
|
self: Box<Self>,
|
||||||
input: iced_native::subscription::Input,
|
input: iced_native::subscription::Input,
|
||||||
) -> futures::stream::BoxStream<'static, Self::Output> {
|
) -> futures::stream::BoxStream<'static, Self::Output> {
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
|
|||||||
@ -167,7 +167,7 @@ mod time {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn stream(
|
fn stream(
|
||||||
&self,
|
self: Box<Self>,
|
||||||
_input: Input,
|
_input: Input,
|
||||||
) -> futures::stream::BoxStream<'static, Self::Output> {
|
) -> futures::stream::BoxStream<'static, Self::Output> {
|
||||||
use futures::stream::StreamExt;
|
use futures::stream::StreamExt;
|
||||||
|
|||||||
@ -470,6 +470,7 @@ impl Subscriptions {
|
|||||||
|
|
||||||
let stream = recipe.stream(event_receiver);
|
let stream = recipe.stream(event_receiver);
|
||||||
|
|
||||||
|
// TODO: Find out how to avoid using a mutex here
|
||||||
let proxy =
|
let proxy =
|
||||||
std::sync::Arc::new(std::sync::Mutex::new(proxy.clone()));
|
std::sync::Arc::new(std::sync::Mutex::new(proxy.clone()));
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user