Skip to main content

Runtime

Struct Runtime 

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

Headless, deterministic evaluator for one owned validated scene.

The runtime owns the document, generated meshes, local action state, and event buffer. It does not render, access clocks, perform I/O, or execute proposed external effects.

Implementations§

Source§

impl Runtime

Source

pub fn new(scene: SceneDocument) -> Result<Self, Diagnostic>

Validates and takes ownership of a scene, then tessellates built-in geometry.

Built-in mesh buffers are allocated once and retained for the runtime’s lifetime. Geometry::Mesh intentionally fails because asset resolution belongs to a platform adapter.

§Errors

Returns validation or tessellation diagnostics, including unresolved mesh assets.

Source

pub fn scene(&self) -> &SceneDocument

Borrows the immutable authored scene document owned by this runtime.

Source

pub fn meshes(&self) -> &BTreeMap<EntityId, Mesh>

Borrows the deterministic built-in meshes keyed by source entity identifier.

Source

pub fn sample(&self, time_seconds: f64) -> Result<Frame, Diagnostic>

Evaluates one frame at an explicit time without changing runtime state.

It allocates owned frame output and temporary transform state, composes parent transforms, and sorts draw records by entity ID. Repeated samples with the same state and time are deterministic.

§Errors

Returns a diagnostic for a non-finite or out-of-range time, or for a composed transform that cannot be represented safely by render adapters.

Source

pub fn dispatch(&mut self, event: Event) -> Result<Receipt, Diagnostic>

Dispatches a declared action and retains its resulting runtime event.

Applied actions toggle animation evaluation or replace a runtime colour. Proposed effects are recorded but never executed. When the bounded event buffer is full, the oldest event is discarded. Invalid events leave the runtime unchanged.

§Errors

Returns a diagnostic when the entity is unknown or does not declare the action.

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.