pub struct Runtime { /* private fields */ }Implementations§
Source§impl Runtime
impl Runtime
pub fn new() -> Self
pub fn window_id(&self) -> WindowId
pub fn set_window_id(&self, id: WindowId)
pub fn window_size(&self) -> Signal<Size>
pub fn window_size_value(&self) -> Size
pub fn window_rect(&self) -> Rect
pub fn viewport_rect(&self) -> Rect
pub fn set_root_fill(&self, enabled: bool)
pub fn scale(&self) -> f32
pub fn set_scale(&self, scale: f32)
pub fn safe_insets(&self) -> Edges
pub fn set_safe_insets(&self, insets: Edges)
pub fn set_environment(&self, env: Environment)
pub fn set_redraw_hook(&self, hook: impl Fn() + 'static)
pub fn request_frame(&self)
Sourcepub fn mark_full_damage(&self)
pub fn mark_full_damage(&self)
Mark the whole viewport as damaged (resize, DPI, theme, root swap).
Sourcepub fn clear_layer_cache(&self)
pub fn clear_layer_cache(&self)
Drops all cached layer snapshots.
Sourcepub fn layer_cache_stats(&self) -> (u64, u64)
pub fn layer_cache_stats(&self) -> (u64, u64)
Returns (hits, misses) for the layer cache.
pub fn needs_frame(&self) -> bool
pub fn damage_flags(&self) -> Dirty
pub fn damage_rect(&self) -> Option<Rect>
Sourcepub fn damage_regions(&self) -> Option<Vec<Rect>>
pub fn damage_regions(&self) -> Option<Vec<Rect>>
Returns the disjoint damage regions for the next frame.
None means a full repaint. Overlapping marks are merged, and a
bounded set of regions is kept so a backend can scissor each one
without unbounded work.
pub fn damage_stats(&self) -> (u64, u64)
Sourcepub fn paint_if_dirty(
&self,
list: &mut RenderList,
text: &mut TextSystem,
) -> FrameOutcome
pub fn paint_if_dirty( &self, list: &mut RenderList, text: &mut TextSystem, ) -> FrameOutcome
Paint only when something changed since the previous frame.
A frame is skipped when there is no pending animation request and the
accumulated flags do not require pixels (Dirty::needs_repaint).
Bookkeeping-only flags (HIT_TEST, DATA) are discarded by the skip.
Returns [FrameOutcome::Skipped] without building a render list.
Sourcepub fn clock(&self) -> FrameClock
pub fn clock(&self) -> FrameClock
Snapshot of the frame clock used by every view animation.
pub fn now(&self) -> Instant
pub fn elapsed_secs(&self) -> f32
pub fn frame_dt_secs(&self) -> f32
pub fn reduced_motion(&self) -> bool
pub fn set_reduced_motion(&self, reduced: bool)
pub fn set_animation_speed(&self, speed: f32)
pub fn animation_speed(&self) -> f32
Sourcepub fn set_manual_clock(&self, manual: bool)
pub fn set_manual_clock(&self, manual: bool)
Switch to explicit time control. Hosts and tests can then call
Runtime::advance_for_test without coupling to wall time.
Sourcepub fn advance_for_test(&self, dt: Duration)
pub fn advance_for_test(&self, dt: Duration)
Advance the shared clock by an exact duration.
This also flips the clock into manual mode, so subsequent tick calls
do not advance it from the wall clock.
pub fn reset_clock(&self)
pub fn live_f32( &self, el: ElementId, prop: Prop, target: f32, tween: Option<&AnimSpec>, spring: Option<&SpringSpec>, ) -> (f32, bool)
pub fn live_color( &self, el: ElementId, prop: Prop, target: Color, tween: Option<&AnimSpec>, ) -> (Color, bool)
pub fn live_color_exp( &self, el: ElementId, prop: Prop, target: Color, rate: f32, ) -> (Color, bool)
pub fn live_vec2( &self, el: ElementId, prop: Prop, target: Vec2, tween: Option<&AnimSpec>, spring: Option<&SpringSpec>, ) -> (Vec2, bool)
pub fn resolve_live_f32( &self, el: ElementId, prop: Prop, live: &Live<f32>, ) -> f32
pub fn resolve_live_vec2( &self, el: ElementId, prop: Prop, live: &Live<Vec2>, ) -> Vec2
pub fn live_anim_count(&self) -> usize
pub fn shapes(&self) -> &ShapeCache
pub fn mount(&self, root: impl View + 'static)
pub fn mount_any(&self, root: AnyView)
pub fn with_state<S: Default + 'static, R>( &self, el: ElementId, f: impl FnOnce(&mut S) -> R, ) -> R
pub fn read_state<S: Default + 'static, R>( &self, el: ElementId, f: impl FnOnce(&S) -> R, ) -> R
pub fn state_count(&self) -> usize
pub fn has_state(&self, el: ElementId) -> bool
pub fn track_scoped(&self, el: ElementId, cancel: impl FnOnce() + 'static)
pub fn scoped_count(&self) -> usize
pub fn request_rebuild(&self, el: ElementId)
pub fn tick(&self)
pub fn root(&self) -> Option<ElementId>
pub fn is_alive(&self, id: ElementId) -> bool
pub fn children(&self, id: ElementId) -> Vec<ElementId>
pub fn children_len(&self, id: ElementId) -> usize
pub fn key_of(&self, id: ElementId) -> Option<u64>
pub fn rect_of(&self, id: ElementId) -> Option<Rect>
pub fn find_by_test_id(&self, test_id: &str) -> Option<ElementId>
pub fn element_count(&self) -> usize
pub fn stats(&self) -> Stats
pub fn errors(&self) -> Vec<RuntimeError>
pub fn errors_seq(&self) -> Signal<u64>
pub fn clear_errors(&self)
pub fn is_descendant_of(&self, el: ElementId, ancestor: ElementId) -> bool
pub fn interact(&self) -> InteractState
pub fn pointer_pos(&self) -> Option<Point>
pub fn cursor_icon(&self) -> CursorIcon
pub fn type_name_of(&self, id: ElementId) -> Option<String>
pub fn view<T: View + 'static>(&self, id: ElementId) -> Option<Rc<T>>
Sourcepub fn layout_dirty(&self) -> bool
pub fn layout_dirty(&self) -> bool
Whether the next Runtime::layout call has work to do.
True for structural rebuilds and pending layout marks. Paint-only damage leaves the layout clean.
Sourcepub fn layout(&self, bounds: Rect, text: &mut TextSystem)
pub fn layout(&self, bounds: Rect, text: &mut TextSystem)
Solves layout for bounds.
The pass is skipped when the viewport and Runtime::layout_dirty are
clean. Structural changes, scroll offsets, layout animations, and new
viewports mark layout dirty.
pub fn paint(&self, list: &mut RenderList, text: &mut TextSystem)
Sourcepub fn paint_region(
&self,
list: &mut RenderList,
text: &mut TextSystem,
cull: CullCtx,
)
pub fn paint_region( &self, list: &mut RenderList, text: &mut TextSystem, cull: CullCtx, )
Paint with recoverable culling driven by cull.
paint keeps the enabled culling path that this runtime used before
the damage work, so existing benchmarks and callers do not pay for
off-screen shaping. CullCtx::DISABLED is available for callers that
need a full CPU pass; RenderList still drops items fully outside the
active clip at push time, so the visible output is the same.
pub fn take_surface_draws(&self) -> Vec<SurfaceDraw>
pub fn hit_test(&self, pos: Point) -> Option<ElementId>
pub fn pointer_move(&self, pos: Point, text: &mut TextSystem)
pub fn pointer_down( &self, pos: Point, button: PointerButton, mods: Modifiers, text: &mut TextSystem, )
pub fn pointer_up( &self, pos: Point, button: PointerButton, mods: Modifiers, text: &mut TextSystem, )
pub fn wheel( &self, pos: Point, delta: Vec2, modifiers: Modifiers, text: &mut TextSystem, )
pub fn pointer_pressure(&self) -> f32
pub fn pointer_tool(&self) -> PenTool
pub fn active_touches(&self) -> Vec<(u64, Point)>
pub fn pen_down( &self, pos: Point, button: PointerButton, pressure: f32, tilt: Vec2, tool: PenTool, mods: Modifiers, text: &mut TextSystem, )
pub fn pen_move( &self, pos: Point, pressure: f32, tilt: Vec2, tool: PenTool, text: &mut TextSystem, )
pub fn pen_up( &self, pos: Point, button: PointerButton, pressure: f32, mods: Modifiers, text: &mut TextSystem, )
pub fn touch_down( &self, id: u64, pos: Point, force: Option<f32>, mods: Modifiers, text: &mut TextSystem, )
pub fn touch_move( &self, id: u64, pos: Point, force: Option<f32>, text: &mut TextSystem, )
pub fn touch_up( &self, id: u64, pos: Point, mods: Modifiers, text: &mut TextSystem, )
pub fn pinch( &self, pos: Point, delta: f32, mods: Modifiers, text: &mut TextSystem, )
pub fn key(&self, key: Key, mods: Modifiers, text: &mut TextSystem)
pub fn ime(&self, event: ImeEvent, text: &mut TextSystem)
pub fn files_hovered( &self, paths: Vec<PathBuf>, pos: Point, text: &mut TextSystem, )
pub fn files_dropped( &self, paths: Vec<PathBuf>, pos: Point, text: &mut TextSystem, )
pub fn files_cancelled(&self, text: &mut TextSystem)
pub fn ime_cursor_rect(&self) -> Option<Rect>
pub fn overlay_show(&self, entry: OverlayEntry) -> OverlayId
pub fn overlay_hide(&self, id: OverlayId) -> bool
pub fn overlay_rect(&self, id: OverlayId) -> Option<Rect>
pub fn overlay_exists(&self, id: OverlayId) -> bool
pub fn overlay_element(&self, id: OverlayId) -> Option<ElementId>
pub fn accessibility_tree(&self) -> Vec<AccessibleNode>
pub fn overlay_ids(&self) -> Vec<OverlayId>
pub fn overlay_count(&self) -> usize
pub fn overlay_set_position(&self, id: OverlayId, x: f32, y: f32) -> bool
pub fn begin_pending( &self, source: ElementId, payload: DragPayload, origin: Point, source_rect: Rect, options: DragOptions, )
pub fn current_drag(&self) -> Option<DragSession>
pub fn has_pending_drag(&self) -> bool
pub fn drag_target_contains(&self, el: ElementId) -> bool
pub fn drop_target_at( &self, pos: Point, payload: &DragPayload, ) -> Option<ElementId>
pub fn cancel_drag(&self, text: &mut TextSystem)
Sourcepub fn text_input_focused(&self) -> bool
pub fn text_input_focused(&self) -> bool
Whether the focused element is a text input.
Hosts use this to suppress plain-key accelerators while the user is typing. Command shortcuts remain available.