Skip to main content

App

Struct App 

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

Unified cross-platform application runtime orchestrating platform events, reactivity, layout, and rendering.

Implementations§

Source§

impl App

Core lifecycle, event dispatch, and frame rendering pipeline for App.

Source

pub fn new(config: AppConfig) -> Result<Self, PlatformError>

Creates an App bound to the active native OS/Web platform backend.

§Arguments
  • AppConfig - Declarative application configuration.
§Returns
  • Result<Self, PlatformError> - Initialized cross-platform app.
Source

pub fn headless(config: AppConfig) -> Result<Self, PlatformError>

Creates an App backed by a deterministic offscreen HeadlessPlatform.

§Arguments
  • AppConfig - Declarative application configuration.
§Returns
  • Result<Self, PlatformError> - Initialized headless app.
Source

pub fn with_platform( config: AppConfig, platform: Box<dyn PlatformBackend>, ) -> Result<Self, PlatformError>

Creates an App backed by an explicit PlatformBackend implementation.

§Arguments
  • AppConfig - Application configuration.
  • Box<dyn PlatformBackend> - Platform backend implementation.
§Returns
  • Result<Self, PlatformError> - Initialized application runtime.
Source

pub fn display_refresh_rate_hz(&self) -> f32

Returns the detected native hardware display refresh rate in Hertz (120.0, 144.0, 180.0, etc.).

§Arguments
  • &Self - Application reference.
§Returns
  • f32 - Active display refresh rate in Hertz.
Source

pub fn update_display_refresh_rate_hz(&mut self, hz: f32)

Updates the detected native hardware display refresh rate reported by an OS or browser host.

§Arguments
  • &Self - Mutable application.
  • f32 - Measured or queried display refresh rate in Hertz.
Source

pub fn report_host_refresh_rate(&mut self, measured_hz: f32)

Reports live host VSync / requestAnimationFrame cadence when the scene is idle so telemetry reflects the real display rate.

§Arguments
  • &Self - Mutable application.
  • f32 - Measured host presentation cadence in Hertz.
Source

pub fn is_ime_active(&self) -> bool

Returns whether an editable input node currently requests the system soft keyboard / IME.

§Arguments
  • &Self - Application reference.
§Returns
  • bool - True when an enabled NodeKind::Input holds keyboard focus.
Source

pub fn last_frame_damage(&self) -> DamageRegion

Returns the damage region rasterized during the most recent rendered frame.

§Arguments
  • &Self - Application reference.
§Returns
  • DamageRegion - Last rendered damage region.
Source

pub fn set_fps_limit(&mut self, limit: Option<u32>)

Configures the cross-platform maximum frame rate (None = unlimited maximum FPS, the default).

§Arguments
  • &Self - Mutable application.
  • Option<u32> - Target FPS cap (Some(1..=1000) or None for uncapped maximum FPS).
Source

pub fn fps_limit(&self) -> Option<u32>

Returns the active cross-platform FPS limit (None = unlimited maximum FPS).

§Arguments
  • &Self - Application reference.
§Returns
  • Option<u32> - Active frame rate cap, or None when uncapped.
Source

pub fn attach_game_host(&mut self, host: GameEngineHost)

Registers a GameEngineHost so all incoming OS/Web WindowEvents are automatically forwarded to its InputState.

§Arguments
  • &Self - Mutable application.
  • GameEngineHost - Game engine host handle to attach.
Source

pub fn has_active_animations(&self) -> bool

Returns true when any node transition animation, inertial scroll, or blinking text caret is actively running.

§Arguments
  • &Self - App reference.
§Returns
  • bool - Whether animations need continuous frame stepping.
Source

pub fn mount<F, C>(&mut self, builder: F) -> NodeId
where F: FnOnce() -> C, C: Component,

Mounts a root Component or NodeId into the application’s scene root with an ambient Context.

§Arguments
  • &Self - Mutable application.
  • F - Zero-argument root builder closure invoking view! or components.
§Returns
  • NodeId - Mounted root content node handle.
Source

pub fn platform_kind(&self) -> PlatformKind

Returns the active PlatformKind.

§Arguments
  • &Self - App reference.
§Returns
  • PlatformKind - Active execution platform.
Source

pub fn platform_capabilities(&self) -> PlatformCapabilities

Returns the active PlatformCapabilities.

§Arguments
  • &Self - App reference.
§Returns
  • PlatformCapabilities - Hardware/OS capability matrix.
Source

pub fn raw_window_handle(&self) -> RawWindowHandle

Returns the RawWindowHandle of the primary window.

§Arguments
  • &Self - App reference.
§Returns
  • RawWindowHandle - Native OS window pointer bundle.
Source

pub fn a11y_tree(&self) -> A11yTree

Compiles a fresh cross-platform A11yTree snapshot from the active retained SceneTree.

§Arguments
  • &Self - App reference.
§Returns
  • A11yTree - Compiled accessibility tree with laid-out bounds and focus state.
Source

pub fn set_render_mode(&mut self, mode: RenderMode)

Dynamically switches the rendering pipeline mode (Auto, Software, Hardware, Hybrid).

§Arguments
  • &Self - Mutable app.
  • RenderMode - Target render mode.
Source

pub fn queue_window_command(&mut self, command: WindowCommand)

Queues a WindowCommand for immediate dispatch on the next frame tick.

§Arguments
  • &Self - Mutable app.
  • WindowCommand - Command to queue.
Source

pub fn set_exact_physical_viewport( &mut self, phys_w: u32, phys_h: u32, scale: f32, )

Sets exact physical pixel surface dimensions and DPI scale without truncating fractional logical sizes.

§Arguments
  • &Self - Mutable app.
  • u32 - Exact physical surface width in device pixels.
  • u32 - Exact physical surface height in device pixels.
  • f32 - Active display DPI scale factor.
Source

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

Processes a single incoming WindowEvent, updating state, hit-testing, and dispatching UI callbacks.

§Arguments
  • &Self - Mutable app.
  • WindowEvent - Event received from the OS or test harness.
Source

pub fn step_frame(&mut self) -> Result<FrameStats, PlatformError>

Executes one complete frame tick: poll events, flush commands, layout, paint, render, and present.

§Arguments
  • &Self - Mutable app.
§Returns
  • Result<FrameStats, PlatformError> - Performance and pixel telemetry for this frame.
Source

pub fn step_game_frame( &mut self, dt_secs: f32, ) -> Result<FrameStats, PlatformError>

Advances the internal FrameClock by dt_secs, executes one full UI/game frame, and resets transient input deltas.

§Arguments
  • &Self - Mutable app.
  • f32 - Elapsed seconds since the previous frame.
§Returns
  • Result<FrameStats, PlatformError> - Frame telemetry for the rendered frame.
Source

pub fn run_frames( &mut self, max_frames: Option<u64>, ) -> Result<FrameStats, PlatformError>

Runs the interactive frame loop until max_frames is reached or the window closes.

§Arguments
  • &Self - Mutable app.
  • Option<u64> - Optional frame limit (None loops until CloseRequested or termination).
§Returns
  • Result<FrameStats, PlatformError> - Telemetry from the final rendered frame.
Source

pub fn cancel_all_active_pointers(&mut self)

Cancels all active pointer/touch contacts and resets transient gesture, drag, and pressed UI state.

§Arguments
  • &Self - Mutable app.
Source

pub fn reconcile_active_touch_ids(&mut self, live_ids: &[u64])

Reconciles active touch contacts against the OS ground-truth live pointer ID list, pruning any stale/missed touches.

§Arguments
  • &Self - Mutable app.
  • &[u64] - Currently active OS touch pointer identifiers.
Source§

impl App

Source

pub fn get_config(&self) -> &AppConfig

Source

pub fn get_mut_config(&mut self) -> &mut AppConfig

Source

pub fn set_config(&mut self, val: AppConfig) -> &mut Self

Source

pub fn get_mut_platform(&mut self) -> &mut Box<dyn PlatformBackend + 'static>

Source

pub fn set_platform( &mut self, val: Box<dyn PlatformBackend + 'static>, ) -> &mut Self

Source

pub fn get_window_state(&self) -> WindowState

Source

pub fn get_mut_window_state(&mut self) -> &mut WindowState

Source

pub fn set_window_state(&mut self, val: WindowState) -> &mut Self

Source

pub fn get_scene(&self) -> &SceneHandle

Source

pub fn get_mut_scene(&mut self) -> &mut SceneHandle

Source

pub fn set_scene(&mut self, val: SceneHandle) -> &mut Self

Source

pub fn get_context(&self) -> &Context

Source

pub fn get_mut_context(&mut self) -> &mut Context

Source

pub fn set_context(&mut self, val: Context) -> &mut Self

Source

pub fn get_layout_engine(&self) -> LayoutEngine

Source

pub fn get_mut_layout_engine(&mut self) -> &mut LayoutEngine

Source

pub fn set_layout_engine(&mut self, val: LayoutEngine) -> &mut Self

Source

pub fn get_renderer(&self) -> &Renderer

Source

pub fn get_mut_renderer(&mut self) -> &mut Renderer

Source

pub fn set_renderer(&mut self, val: Renderer) -> &mut Self

Source

pub fn get_command_queue(&self) -> &WindowCommandQueue

Source

pub fn get_mut_command_queue(&mut self) -> &mut WindowCommandQueue

Source

pub fn set_command_queue(&mut self, val: WindowCommandQueue) -> &mut Self

Source

pub fn get_storage(&self) -> &StorageStore

Source

pub fn get_mut_storage(&mut self) -> &mut StorageStore

Source

pub fn set_storage(&mut self, val: StorageStore) -> &mut Self

Source

pub fn get_running(&self) -> bool

Source

pub fn get_mut_running(&mut self) -> &mut bool

Source

pub fn set_running(&mut self, val: bool) -> &mut Self

Source

pub fn get_pending_damage(&self) -> DamageRegion

Source

pub fn get_mut_pending_damage(&mut self) -> &mut DamageRegion

Source

pub fn set_pending_damage(&mut self, val: DamageRegion) -> &mut Self

Source

pub fn get_input_state(&self) -> &InputState

Source

pub fn get_mut_input_state(&mut self) -> &mut InputState

Source

pub fn set_input_state(&mut self, val: InputState) -> &mut Self

Source

pub fn get_frame_clock(&self) -> FrameClock

Source

pub fn get_mut_frame_clock(&mut self) -> &mut FrameClock

Source

pub fn set_frame_clock(&mut self, val: FrameClock) -> &mut Self

Source

pub fn get_services(&self) -> &PlatformServiceHub

Source

pub fn get_mut_services(&mut self) -> &mut PlatformServiceHub

Source

pub fn set_services(&mut self, val: PlatformServiceHub) -> &mut Self

Source

pub fn get_dynamic_hub(&self) -> &DynamicUpdateHub

Source

pub fn get_mut_dynamic_hub(&mut self) -> &mut DynamicUpdateHub

Source

pub fn set_dynamic_hub(&mut self, val: DynamicUpdateHub) -> &mut Self

Source

pub fn get_last_rendered_revision(&self) -> u64

Source

pub fn get_mut_last_rendered_revision(&mut self) -> &mut u64

Source

pub fn set_last_rendered_revision(&mut self, val: u64) -> &mut Self

Source

pub fn get_last_cursor(&self) -> CursorIcon

Source

pub fn get_mut_last_cursor(&mut self) -> &mut CursorIcon

Source

pub fn set_last_cursor(&mut self, val: CursorIcon) -> &mut Self

Source

pub fn get_game_hosts(&self) -> &Vec<GameEngineHost>

Source

pub fn get_mut_game_hosts(&mut self) -> &mut Vec<GameEngineHost>

Source

pub fn set_game_hosts(&mut self, val: Vec<GameEngineHost>) -> &mut Self

Source

pub fn get_mut_touch_drag_pointer_id(&mut self) -> &mut Option<u64>

Source

pub fn set_touch_drag_pointer_id(&mut self, val: Option<u64>) -> &mut Self

Source

pub fn get_mut_touch_drag_origin(&mut self) -> &mut Option<Point>

Source

pub fn set_touch_drag_origin(&mut self, val: Option<Point>) -> &mut Self

Source

pub fn get_mut_touch_drag_last(&mut self) -> &mut Option<Point>

Source

pub fn set_touch_drag_last(&mut self, val: Option<Point>) -> &mut Self

Source

pub fn get_touch_dragging(&self) -> bool

Source

pub fn get_mut_touch_dragging(&mut self) -> &mut bool

Source

pub fn set_touch_dragging(&mut self, val: bool) -> &mut Self

Source

pub fn get_touch_drag_travel(&self) -> f32

Source

pub fn get_mut_touch_drag_travel(&mut self) -> &mut f32

Source

pub fn set_touch_drag_travel(&mut self, val: f32) -> &mut Self

Source

pub fn get_touch_scroll_axis(&self) -> u8

Source

pub fn get_mut_touch_scroll_axis(&mut self) -> &mut u8

Source

pub fn set_touch_scroll_axis(&mut self, val: u8) -> &mut Self

Source

pub fn get_touch_vel_accum_delta(&self) -> Point

Source

pub fn get_mut_touch_vel_accum_delta(&mut self) -> &mut Point

Source

pub fn set_touch_vel_accum_delta(&mut self, val: Point) -> &mut Self

Source

pub fn get_touch_vel_samples(&self) -> &Vec<(f32, f32, f32)>

Source

pub fn get_mut_touch_vel_samples(&mut self) -> &mut Vec<(f32, f32, f32)>

Source

pub fn set_touch_vel_samples(&mut self, val: Vec<(f32, f32, f32)>) -> &mut Self

Source

pub fn get_touch_vel_idle_secs(&self) -> f32

Source

pub fn get_mut_touch_vel_idle_secs(&mut self) -> &mut f32

Source

pub fn set_touch_vel_idle_secs(&mut self, val: f32) -> &mut Self

Source

pub fn get_scrollbar_dragging(&self) -> bool

Source

pub fn get_mut_scrollbar_dragging(&mut self) -> &mut bool

Source

pub fn set_scrollbar_dragging(&mut self, val: bool) -> &mut Self

Source

pub fn get_active_pointers(&self) -> &HashMap<u64, Point>

Source

pub fn get_mut_active_pointers(&mut self) -> &mut HashMap<u64, Point>

Source

pub fn set_active_pointers(&mut self, val: HashMap<u64, Point>) -> &mut Self

Source

pub fn get_active_pointer_devices(&self) -> &HashMap<u64, PointerDevice>

Source

pub fn get_mut_active_pointer_devices( &mut self, ) -> &mut HashMap<u64, PointerDevice>

Source

pub fn set_active_pointer_devices( &mut self, val: HashMap<u64, PointerDevice>, ) -> &mut Self

Source

pub fn get_mut_gesture_origin(&mut self) -> &mut Option<Point>

Source

pub fn set_gesture_origin(&mut self, val: Option<Point>) -> &mut Self

Source

pub fn get_pinch_base_dist(&self) -> f32

Source

pub fn get_mut_pinch_base_dist(&mut self) -> &mut f32

Source

pub fn set_pinch_base_dist(&mut self, val: f32) -> &mut Self

Source

pub fn get_gesture_hold_secs(&self) -> f32

Source

pub fn get_mut_gesture_hold_secs(&mut self) -> &mut f32

Source

pub fn set_gesture_hold_secs(&mut self, val: f32) -> &mut Self

Source

pub fn get_long_press_fired(&self) -> bool

Source

pub fn get_mut_long_press_fired(&mut self) -> &mut bool

Source

pub fn set_long_press_fired(&mut self, val: bool) -> &mut Self

Source

pub fn get_mut_last_tap_pos(&mut self) -> &mut Option<Point>

Source

pub fn set_last_tap_pos(&mut self, val: Option<Point>) -> &mut Self

Source

pub fn get_last_tap_age_secs(&self) -> f32

Source

pub fn get_mut_last_tap_age_secs(&mut self) -> &mut f32

Source

pub fn set_last_tap_age_secs(&mut self, val: f32) -> &mut Self

Source

pub fn get_gesture_seq(&self) -> u64

Source

pub fn get_mut_gesture_seq(&mut self) -> &mut u64

Source

pub fn set_gesture_seq(&mut self, val: u64) -> &mut Self

Source

pub fn get_scroll_velocity(&self) -> Point

Source

pub fn get_mut_scroll_velocity(&mut self) -> &mut Point

Source

pub fn set_scroll_velocity(&mut self, val: Point) -> &mut Self

Source

pub fn get_scroll_fling_pos(&self) -> Point

Source

pub fn get_mut_scroll_fling_pos(&mut self) -> &mut Point

Source

pub fn set_scroll_fling_pos(&mut self, val: Point) -> &mut Self

Source

pub fn get_mut_touch_scroll_target(&mut self) -> &mut Option<NodeId>

Source

pub fn set_touch_scroll_target(&mut self, val: Option<NodeId>) -> &mut Self

Source

pub fn get_smooth_scroll_pending(&self) -> Point

Source

pub fn get_mut_smooth_scroll_pending(&mut self) -> &mut Point

Source

pub fn set_smooth_scroll_pending(&mut self, val: Point) -> &mut Self

Source

pub fn get_smooth_scroll_pos(&self) -> Point

Source

pub fn get_mut_smooth_scroll_pos(&mut self) -> &mut Point

Source

pub fn set_smooth_scroll_pos(&mut self, val: Point) -> &mut Self

Source

pub fn get_mut_smooth_scroll_target(&mut self) -> &mut Option<NodeId>

Source

pub fn set_smooth_scroll_target(&mut self, val: Option<NodeId>) -> &mut Self

Source

pub fn get_in_step_frame(&self) -> bool

Source

pub fn get_mut_in_step_frame(&mut self) -> &mut bool

Source

pub fn set_in_step_frame(&mut self, val: bool) -> &mut Self

Source

pub fn get_gesture_suppressed(&self) -> bool

Source

pub fn get_mut_gesture_suppressed(&mut self) -> &mut bool

Source

pub fn set_gesture_suppressed(&mut self, val: bool) -> &mut Self

Source

pub fn get_fps_accum_secs(&self) -> f32

Source

pub fn get_mut_fps_accum_secs(&mut self) -> &mut f32

Source

pub fn set_fps_accum_secs(&mut self, val: f32) -> &mut Self

Source

pub fn get_fps_accum_frames(&self) -> u32

Source

pub fn get_mut_fps_accum_frames(&mut self) -> &mut u32

Source

pub fn set_fps_accum_frames(&mut self, val: u32) -> &mut Self

Source

pub fn get_fps_budget_accum(&self) -> f32

Source

pub fn get_mut_fps_budget_accum(&mut self) -> &mut f32

Source

pub fn set_fps_budget_accum(&mut self, val: f32) -> &mut Self

Source

pub fn get_last_ime_active(&self) -> bool

Source

pub fn get_mut_last_ime_active(&mut self) -> &mut bool

Source

pub fn set_last_ime_active(&mut self, val: bool) -> &mut Self

Source

pub fn get_mut_last_ime_node(&mut self) -> &mut Option<NodeId>

Source

pub fn set_last_ime_node(&mut self, val: Option<NodeId>) -> &mut Self

Source

pub fn get_last_frame_damage(&self) -> DamageRegion

Source

pub fn get_mut_last_frame_damage(&mut self) -> &mut DamageRegion

Source

pub fn set_last_frame_damage(&mut self, val: DamageRegion) -> &mut Self

Source

pub fn get_display_refresh_rate_hz(&self) -> f32

Source

pub fn get_mut_display_refresh_rate_hz(&mut self) -> &mut f32

Source

pub fn set_display_refresh_rate_hz(&mut self, val: f32) -> &mut Self

Source

pub fn get_was_animating(&self) -> bool

Source

pub fn get_mut_was_animating(&mut self) -> &mut bool

Source

pub fn set_was_animating(&mut self, val: bool) -> &mut Self

Trait Implementations§

Source§

impl Debug for App

Source§

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

Formats the struct fields as a debug struct, skipping excluded fields.

§Arguments
  • &mut ::std::fmt::Formatter<'_> - The formatter to write the representation into.
§Returns
  • ::std::fmt::Result - Success or failure of the formatting operation.

Auto Trait Implementations§

§

impl !RefUnwindSafe for App

§

impl !Send for App

§

impl !Sync for App

§

impl !UnwindSafe for App

§

impl Forget for App

§

impl Freeze for App

§

impl Move for App

§

impl Unpin for App

§

impl UnsafeUnpin for App

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.