[−][src]Struct iced_futures::subscription::Tracker
A registry of subscription streams.
If you have an application that continuously returns a Subscription
,
you can use a Tracker
to keep track of the different recipes and keep
its executions alive.
Implementations
impl<Hasher, Event> Tracker<Hasher, Event> where
Hasher: Hasher + Default,
Event: 'static + Send + Clone,
[src]
Hasher: Hasher + Default,
Event: 'static + Send + Clone,
pub fn new() -> Self
[src]
Creates a new empty Tracker
.
pub fn update<Message, Receiver>(
&mut self,
subscription: Subscription<Hasher, Event, Message>,
receiver: Receiver
) -> Vec<BoxFuture<()>> where
Message: 'static + Send,
Receiver: 'static + Sink<Message, Error = SendError> + Unpin + Send + Clone,
[src]
&mut self,
subscription: Subscription<Hasher, Event, Message>,
receiver: Receiver
) -> Vec<BoxFuture<()>> where
Message: 'static + Send,
Receiver: 'static + Sink<Message, Error = SendError> + Unpin + Send + Clone,
Updates the Tracker
with the given Subscription
.
A Subscription
can cause new streams to be spawned or old streams
to be closed.
The Tracker
keeps track of these streams between calls to this
method:
- If the provided
Subscription
contains a newRecipe
that is currently not being run, it will spawn a new stream and keep it alive. - On the other hand, if a
Recipe
is currently in execution and the providedSubscription
does not contain it anymore, then theTracker
will close and drop the relevant stream.
It returns a list of futures that need to be spawned to materialize
the Tracker
changes.
pub fn broadcast(&mut self, event: Event)
[src]
Broadcasts an event to the subscriptions currently alive.
A subscription's Recipe::stream
always receives a stream of events
as input. This stream can be used by some subscription to listen to
shell events.
This method publishes the given event to all the subscription streams currently open.
Trait Implementations
Auto Trait Implementations
impl<Hasher, Event> !RefUnwindSafe for Tracker<Hasher, Event>
impl<Hasher, Event> Send for Tracker<Hasher, Event> where
Event: Send,
Hasher: Send,
Event: Send,
Hasher: Send,
impl<Hasher, Event> Sync for Tracker<Hasher, Event> where
Event: Send,
Hasher: Sync,
Event: Send,
Hasher: Sync,
impl<Hasher, Event> Unpin for Tracker<Hasher, Event> where
Hasher: Unpin,
Hasher: Unpin,
impl<Hasher, Event> !UnwindSafe for Tracker<Hasher, Event>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,