Skip to main content

Runtime

Struct Runtime 

Source
pub struct Runtime<S: Spec, A: App<Spec = S>> { /* private fields */ }
Expand description

The tick loop around the kernel. S is the app’s vocabulary, A the app itself.

Implementations§

Source§

impl<S: Spec, A: App<Spec = S>> Runtime<S, A>

Source

pub fn new(app: A, cfg: RuntimeConfig, waker: Waker) -> (Self, Handle<S>)

Build the runtime and the app’s handle (design §2.5). The app’s App::init runs once, before the first tick; its commands and the config’s startup windows land in the first tick’s drain.

Source

pub fn push_input(&mut self, input: InputEnvelope)

Feed one host input event; the next tick routes it.

Source

pub fn tick(&mut self, now: Seconds) -> TickOutput

One tick (design §2.5): drain the inbox, phases 1-4 and 7, deliver the intents (their commands feed the settle passes), then zero-input settle passes until quiet, at most MAX_SETTLE.

Source

pub fn paint(&mut self, req: &FrameRequest, ctx: &mut dyn RenderContext)

Paint one due frame request (phases 5-6 for its window). The commands the hooks declare apply from the next tick’s drain.

Source

pub fn take_paint_wants_tick(&mut self) -> bool

A paint since the last call asked for more work (a hook’s request_frame, declared commands, clicks to deliver). The tick’s wake predates the paint, so hosts check this after painting and tick again instead of going idle.

Source

pub fn snapshot(&self) -> Arc<VisualSnapshot<S>> ⓘ

The last published snapshot (same read as the handle’s).

Source

pub fn revision(&self) -> Revision

The published revision.

Source

pub fn should_exit(&self) -> bool

The host should exit its loop (every window closed or Shutdown).

Source

pub fn app(&self) -> &A

The app, for hosts that drive app-level tools (tests).

Source

pub fn app_mut(&mut self) -> &mut A

The app, mutably, outside any hook (tests, host tools).

Auto Trait Implementations§

§

impl<S, A> !RefUnwindSafe for Runtime<S, A>

§

impl<S, A> !Sync for Runtime<S, A>

§

impl<S, A> !UnwindSafe for Runtime<S, A>

§

impl<S, A> Freeze for Runtime<S, A>

§

impl<S, A> Send for Runtime<S, A>
where A: Send, Kernel<S>: Send, Receiver<AppCommand<S>>: Send, Arc<ArcSwapAny<Arc<VisualSnapshot<S>>>>: Send, Vec<AppCommand<S>>: Send,

§

impl<S, A> Unpin for Runtime<S, A>

§

impl<S, A> UnsafeUnpin for Runtime<S, A>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.