pub struct Runtime { /* private fields */ }Expand description
Owns the state cells, UI tasks, frame callbacks and invalidated scopes of one composition. Clones share the same runtime.
Implementations§
Source§impl Runtime
impl Runtime
Sourcepub fn new(scheduler: SchedulerRef) -> Self
pub fn new(scheduler: SchedulerRef) -> Self
Creates a runtime whose UI thread is the current thread. scheduler is asked for a frame
whenever the runtime has work.
Sourcepub fn handle(&self) -> RuntimeHandle
pub fn handle(&self) -> RuntimeHandle
Returns a handle that reaches this runtime without keeping it alive.
Sourcepub fn has_updates(&self) -> bool
pub fn has_updates(&self) -> bool
Returns true if node updates are queued or any recompose scope is invalid.
Sourcepub fn needs_frame(&self) -> bool
pub fn needs_frame(&self) -> bool
Returns true if the runtime has asked for a frame or has a task ready to run.
Sourcepub fn set_needs_frame(&self, value: bool)
pub fn set_needs_frame(&self, value: bool)
Sets or clears the request for a frame.
Sourcepub fn has_pending_ui(&self) -> bool
pub fn has_pending_ui(&self) -> bool
Returns true if posted UI work has not run yet. The owner of a
runtime asks it here; a RuntimeHandle costs a clone of its parts.
Sourcepub fn has_invalid_scopes(&self) -> bool
pub fn has_invalid_scopes(&self) -> bool
Returns true if any recompose scope is invalid.
Sourcepub fn has_frame_callbacks(&self) -> bool
pub fn has_frame_callbacks(&self) -> bool
Returns true if any frame callback is registered.
Sourcepub fn has_transient_frame_callbacks(&self) -> bool
pub fn has_transient_frame_callbacks(&self) -> bool
Returns true while a one-shot frame callback waits for the next
frame. Perpetual frame callbacks do not count.
Sourcepub fn drain_frame_callbacks(&self, frame_time_nanos: u64)
pub fn drain_frame_callbacks(&self, frame_time_nanos: u64)
Runs the frame callbacks due at frame_time_nanos.
Sourcepub fn last_frame_time_nanos(&self) -> Option<u64>
pub fn last_frame_time_nanos(&self) -> Option<u64>
Animation-clock time of the most recent frame-callback drain. This is
the same clock Animatables advance on (virtual under robot exact
captures), so per-frame integrators derive dt from it instead of wall
time.
Sourcepub fn frame_clock(&self) -> FrameClock
pub fn frame_clock(&self) -> FrameClock
Returns a clock for the frames of this runtime.