Struct iced_futures::Runtime
source · pub struct Runtime<Hasher, Event, Executor, Sender, Message> { /* private fields */ }
Expand description
A batteries-included runtime of commands and subscriptions.
If you have an Executor
, a Runtime
can be leveraged to run any
Command
or Subscription
and get notified of the results!
Implementations§
source§impl<Hasher, Event, Executor, Sender, Message> Runtime<Hasher, Event, Executor, Sender, Message>where
Hasher: Hasher + Default,
Event: Send + Clone + 'static,
Executor: Executor,
Sender: Sink<Message, Error = SendError> + Unpin + MaybeSend + Clone + 'static,
Message: MaybeSend + 'static,
impl<Hasher, Event, Executor, Sender, Message> Runtime<Hasher, Event, Executor, Sender, Message>where
Hasher: Hasher + Default,
Event: Send + Clone + 'static,
Executor: Executor,
Sender: Sink<Message, Error = SendError> + Unpin + MaybeSend + Clone + 'static,
Message: MaybeSend + 'static,
sourcepub fn enter<R>(&self, f: impl FnOnce() -> R) -> R
pub fn enter<R>(&self, f: impl FnOnce() -> R) -> R
Runs the given closure inside the Executor
of the Runtime
.
See Executor::enter
to learn more.
sourcepub fn track(&mut self, subscription: Subscription<Hasher, Event, Message>)
pub fn track(&mut self, subscription: Subscription<Hasher, Event, Message>)
Tracks a Subscription
in the Runtime
.
It will spawn new streams or close old ones as necessary! See
Tracker::update
to learn more about this!
sourcepub fn broadcast(&mut self, event: Event)
pub fn broadcast(&mut self, event: Event)
Broadcasts an event to all the subscriptions currently alive in the
Runtime
.
See Tracker::broadcast
to learn more.