[][src]Struct iced_futures::subscription::Tracker

pub struct Tracker<Hasher, Event> { /* fields omitted */ }

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]

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]

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 new Recipe 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 provided Subscription does not contain it anymore, then the Tracker 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

impl<Hasher: Debug, Event: Debug> Debug for Tracker<Hasher, Event>[src]

Auto Trait Implementations

impl<Hasher, Event> !RefUnwindSafe for Tracker<Hasher, Event>

impl<Hasher, Event> Send for Tracker<Hasher, Event> where
    Event: Send,
    Hasher: Send

impl<Hasher, Event> Sync for Tracker<Hasher, Event> where
    Event: Send,
    Hasher: Sync

impl<Hasher, Event> Unpin for Tracker<Hasher, Event> where
    Hasher: Unpin

impl<Hasher, Event> !UnwindSafe for Tracker<Hasher, Event>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.