engine

Submodules

Structs

Globals

Engine-wide reactive globals exposed to every component frame.

Properties

elapsed_frames

Type: LocalProperty<u64>

elapsed_millis

Type: LocalProperty<u64>

viewport

Type: LocalProperty<TransformAndBounds<NodeLocal, Window>>

gyro

Type: LocalProperty<Gyro>

accel

Type: LocalProperty<Accel>

route_location

Type: LocalProperty<RouteLocation>

browser_allows_scroller_vector_layers

Type: LocalProperty<bool>

browser_allows_nested_scroller_vector_layers

Type: LocalProperty<bool>

platform

Type: Platform

os

Type: OS

target

Type: TargetInfo

get_elapsed_millis

Type: Rc<dyn Fn() -> u128>

Implementations

stack_frame
pub fn stack_frame(&self) -> Rc<RuntimePropertiesStackFrame>

Build the root stack frame containing built-in globals plus internal engine state.


Handler

Runtime event handler thunk generated from template bindings.

Properties

function

Type: fn()

location

Type: HandlerLocation

Implementations

new_component_handler
pub fn new_component_handler(function: fn()) -> Self

Build a handler whose self and context both belong to the target component.

new_inline_handler
pub fn new_inline_handler(function: fn()) -> Self

Build a handler whose self is the component that authored the inline binding. The context still describes the primitive or child component receiving the call.


HandlerRegistry

Map from event key to one or more handlers registered on an instance node.

Properties

handlers

Type: HashMap<String, Vec<Handler>>


PaxEngine

Singleton struct storing everything related to properties computation & rendering

Properties

runtime_context

Type: Rc<RuntimeContext>

root_expanded_node

Type: Option<Rc<ExpandedNode>>

scroller_tiling_policy

Type: ScrollerTilingPolicy

Implementations

Central instance of the PaxEngine and runtime, intended to be created by a particular chassis. Contains all rendering and runtime logic.

activate_application
pub fn activate_application(&self)

Activates the mounted application exactly once. Candidate hosts defer this until their revision is committed.

mount_root_component
pub fn mount_root_component(&mut self, main_component_instance: Rc<ComponentInstance>) -> Rc<ExpandedNode>

Mount a root component tree into an existing runtime kernel.

set_viewport_size
pub fn set_viewport_size(&mut self, new_viewport_size: (f64, f64))

Called by chassis when viewport size changes, e.g. with native window resizes

shutdown
pub fn shutdown(&mut self, reason: StopReason)

Stops new application work, unmounts, then begins retained resource cleanup.

tick
pub fn tick(&mut self) -> Vec<NativeMessage>

Workhorse methods of every tick. Will be executed up to 240 Hz. Three phases:

  1. Expand nodes & compute properties; recurse entire instance tree and evaluate ExpandedNodes, stitching together parent/child relationships between ExpandedNodes along the way.
  2. Compute layout (z-index & TransformAndBounds) by visiting ExpandedNode tree in rendering order, writing computed rendering-specific values to ExpandedNodes
  3. Render: a. find lowest node (last child of last node) b. start rendering, from lowest node on-up, throughout tree
unmount
pub fn unmount(&mut self)

Detach the mounted root component tree, leaving the runtime kernel empty.

Enums

HandlerLocation

Selects the Rust state owner independently of the handler's target NodeContext.

Variants

Inline

A binding on a template element: use the component that authored the element.

Component

A component's own settings or conventional method: use the target component.