pub struct Runtime { /* private fields */ }Expand description
The execution engine for a vtui application.
A Runtime owns all state required to execute a component tree, including registered draw
handlers, event listeners, and internal queues. It is built from a fully-declared Component
and is responsible for driving the draw–update lifecycle.
§Event loop model
The runtime operates in a strict, single-threaded loop with well-defined phases:
Draws occur first in order to calculate layout for potential hit-testing events such as mouse clicks. These occur synchronously from parent to children components.
A runtime update is performed immediately after, which blocks the event loop until it can consume some event. This can range from user IO, promise completions/cancellations, tick events, and more. It is also possible for the runtime to perform batching or coalescing of events in a manner that is invariant to the draw function.
During a runtime update, a listener may potentially politely request shutdown. Once the runtime is comfortable with a shutdown, the event loop exits.
§Concurrency
The runtime is single-threaded and not Send or Sync. Concurrent systems,
such as async tasks or input streams, may enqueue events via channels, but
the runtime itself processes all events deterministically on one thread.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Runtime
impl !RefUnwindSafe for Runtime
impl !Send for Runtime
impl !Sync for Runtime
impl Unpin for Runtime
impl !UnwindSafe for Runtime
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more