Skip to main content

Runtime

Struct Runtime 

Source
pub struct Runtime { /* private fields */ }
Expand description

Coordinates frame-scoped input with a fixed-rate simulation clock.

Implementations§

Source§

impl Runtime

Source

pub fn new(config: RuntimeConfig, started_at: Instant) -> Self

Starts a runtime clock at started_at with no accumulated simulation debt.

Source

pub fn handle_input(&mut self, event: InputEvent)

Adds one ordered native input transition to the current snapshot.

Source

pub fn handle_window_event(&mut self, event: WindowEvent)

Applies the input and rendering-lifecycle parts of one platform window event.

Redraw, metrics, and close policy remain with the application. Lower-level input, suspend, and resume methods remain available when an application uses a different coordination shape.

Source

pub const fn input(&self) -> &InputSnapshot

Returns the held state and transitions accumulated for the current frame.

Source

pub fn begin_frame(&mut self, now: Instant) -> RuntimeFrame<'_>

Begins a scoped frame with fixed simulation work, input, and render interpolation.

Dropping the returned frame automatically ends the input snapshot, including on early return.

Source

pub fn suspend(&mut self)

Pauses frame timing and releases every held input control.

The fractional fixed-step accumulator is preserved so rendering can resume without a small interpolation jump. Calls to Self::begin_frame while suspended schedule no updates.

Source

pub fn resume(&mut self, now: Instant)

Resumes frame timing from now without treating the suspended interval as elapsed game time.

Source

pub const fn suspended(&self) -> bool

Returns whether frame timing is currently suspended.

Trait Implementations§

Source§

impl Debug for Runtime

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.