[−][src]Struct iced_futures::Runtime
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
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 + Send + Clone + 'static,
Message: Send + 'static,
[src]
Hasher: Hasher + Default,
Event: Send + Clone + 'static,
Executor: Executor,
Sender: Sink<Message, Error = SendError> + Unpin + Send + Clone + 'static,
Message: Send + 'static,
pub fn new(executor: Executor, sender: Sender) -> Self
[src]
Creates a new empty Runtime
.
You need to provide:
- an
Executor
to spawn futures - a
Sender
implementingSink
to receive the results
pub fn enter<R>(&self, f: impl FnOnce() -> R) -> R
[src]
Runs the given closure inside the Executor
of the Runtime
.
See Executor::enter
to learn more.
pub fn spawn(&mut self, command: Command<Message>)
[src]
Spawns a Command
in the Runtime
.
The resulting Message
will be forwarded to the Sender
of the
Runtime
.
pub fn track(&mut self, subscription: Subscription<Hasher, Event, Message>)
[src]
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!
pub fn broadcast(&mut self, event: Event)
[src]
Broadcasts an event to all the subscriptions currently alive in the
Runtime
.
See Tracker::broadcast
to learn more.
Trait Implementations
impl<Hasher: Debug, Event: Debug, Executor: Debug, Sender: Debug, Message: Debug> Debug for Runtime<Hasher, Event, Executor, Sender, Message>
[src]
Auto Trait Implementations
impl<Hasher, Event, Executor, Sender, Message> !RefUnwindSafe for Runtime<Hasher, Event, Executor, Sender, Message>
impl<Hasher, Event, Executor, Sender, Message> Send for Runtime<Hasher, Event, Executor, Sender, Message> where
Event: Send,
Executor: Send,
Hasher: Send,
Message: Send,
Sender: Send,
Event: Send,
Executor: Send,
Hasher: Send,
Message: Send,
Sender: Send,
impl<Hasher, Event, Executor, Sender, Message> Sync for Runtime<Hasher, Event, Executor, Sender, Message> where
Event: Send,
Executor: Sync,
Hasher: Sync,
Message: Sync,
Sender: Sync,
Event: Send,
Executor: Sync,
Hasher: Sync,
Message: Sync,
Sender: Sync,
impl<Hasher, Event, Executor, Sender, Message> Unpin for Runtime<Hasher, Event, Executor, Sender, Message> where
Executor: Unpin,
Hasher: Unpin,
Message: Unpin,
Sender: Unpin,
Executor: Unpin,
Hasher: Unpin,
Message: Unpin,
Sender: Unpin,
impl<Hasher, Event, Executor, Sender, Message> !UnwindSafe for Runtime<Hasher, Event, Executor, Sender, Message>
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>,