pub struct Runtime<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<Executor, Sender, Message> Runtime<Executor, Sender, Message>
impl<Executor, Sender, Message> Runtime<Executor, Sender, Message>
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 block_on<T>(&mut self, future: impl Future<Output = T>) -> T
Available on non-WebAssembly only.
pub fn block_on<T>(&mut self, future: impl Future<Output = T>) -> T
Runs a future to completion in the current thread within the Runtime
.
Sourcepub fn track(
&mut self,
recipes: impl IntoIterator<Item = Box<dyn Recipe<Output = Message>>>,
)
pub fn track( &mut self, recipes: impl IntoIterator<Item = Box<dyn Recipe<Output = 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.
Trait Implementations§
Auto Trait Implementations§
impl<Executor, Sender, Message> Freeze for Runtime<Executor, Sender, Message>
impl<Executor, Sender, Message> !RefUnwindSafe for Runtime<Executor, Sender, Message>
impl<Executor, Sender, Message> Send for Runtime<Executor, Sender, Message>
impl<Executor, Sender, Message> Sync for Runtime<Executor, Sender, Message>
impl<Executor, Sender, Message> Unpin for Runtime<Executor, Sender, Message>
impl<Executor, Sender, Message> !UnwindSafe for Runtime<Executor, Sender, Message>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more