Struct iced_futures::Runtime[][src]

pub struct Runtime<Hasher, Event, Executor, Sender, Message> { /* fields omitted */ }

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]

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 implementing Sink 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

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

impl<Hasher, Event, Executor, Sender, Message> Unpin for Runtime<Hasher, Event, Executor, Sender, Message> where
    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]

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.