Introduce subscription::Event
... and remove `PlatformSpecific` from `Event`
This commit is contained in:
parent
83296a73eb
commit
5d7dcf417c
13 changed files with 156 additions and 129 deletions
|
|
@ -1,6 +1,4 @@
|
|||
use crate::core::event::{self, Event};
|
||||
use crate::core::window;
|
||||
use crate::subscription::{Hasher, Recipe};
|
||||
use crate::subscription::{Event, Hasher, Recipe};
|
||||
use crate::{BoxFuture, MaybeSend};
|
||||
|
||||
use futures::channel::mpsc;
|
||||
|
|
@ -24,9 +22,7 @@ pub struct Tracker {
|
|||
#[derive(Debug)]
|
||||
pub struct Execution {
|
||||
_cancel: futures::channel::oneshot::Sender<()>,
|
||||
listener: Option<
|
||||
futures::channel::mpsc::Sender<(Event, event::Status, window::Id)>,
|
||||
>,
|
||||
listener: Option<futures::channel::mpsc::Sender<Event>>,
|
||||
}
|
||||
|
||||
impl Tracker {
|
||||
|
|
@ -142,19 +138,12 @@ impl Tracker {
|
|||
/// currently open.
|
||||
///
|
||||
/// [`Recipe::stream`]: crate::subscription::Recipe::stream
|
||||
pub fn broadcast(
|
||||
&mut self,
|
||||
event: Event,
|
||||
status: event::Status,
|
||||
window: window::Id,
|
||||
) {
|
||||
pub fn broadcast(&mut self, event: Event) {
|
||||
self.subscriptions
|
||||
.values_mut()
|
||||
.filter_map(|connection| connection.listener.as_mut())
|
||||
.for_each(|listener| {
|
||||
if let Err(error) =
|
||||
listener.try_send((event.clone(), status, window))
|
||||
{
|
||||
if let Err(error) = listener.try_send(event.clone()) {
|
||||
log::warn!(
|
||||
"Error sending event to subscription: {error:?}"
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue