Skip to main content

Scene

Struct Scene 

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

Host-independent retained scene for one surface.

The scene begins in snapshot mode. After a frame is prepared, mutations are rejected until the caller accepts or discards it. This makes clearing the journal on acceptance lossless without requiring a second concurrent dirty generation.

Implementations§

Source§

impl Scene

Source

pub fn hit_test( &self, root: NodeId, point: InputPoint, ) -> Result<Option<NodeId>, SceneError>

Finds the visually topmost node at one surface-space point.

Source

pub fn text_span_at( &self, node: NodeId, point: InputPoint, ) -> Option<TextSpanId>

Resolves a visible inline source span at a surface-space pointer position.

Source§

impl Scene

Source

pub fn new(surface: SurfaceId) -> Self

Creates an empty scene that will emit a snapshot on its first frame.

Source

pub fn with_protocol(surface: SurfaceId, protocol: ProtocolVersion) -> Self

Creates an empty scene using the version selected with its Host.

Source

pub const fn surface(&self) -> SurfaceId

Returns the destination surface.

Source

pub const fn scene_epoch(&self) -> u32

Returns the current scene epoch.

Source

pub const fn accepted_revision(&self) -> u64

Returns the last renderer-accepted revision.

Source

pub fn node_count(&self) -> usize

Returns the number of live retained nodes.

Source

pub fn node(&self, node: NodeId) -> Option<&SceneNode>

Returns a retained node when it is live.

Source

pub fn node_snapshot(&self, node: NodeId) -> Option<Arc<SceneNode>>

Retains an immutable node snapshot without copying its content or geometry.

Source

pub fn pointer_capture_target(&self, pointer: PointerId) -> Option<NodeId>

Returns the node currently retaining one pointer capture.

Source

pub fn has_pending_work(&self) -> bool

Returns whether a snapshot, mutation, command, or retry needs a frame.

Source

pub fn has_prepared_frame(&self) -> bool

Returns whether a prepared frame is waiting for acceptance or discard.

Source

pub fn create_node( &mut self, element_type: ElementTypeId, ) -> Result<NodeId, SceneError>

Creates an unattached retained node and returns its epoch-unique ID.

Source

pub fn delete_node(&mut self, node: NodeId) -> Result<(), SceneError>

Deletes a node and its complete retained subtree.

Source

pub fn insert_child( &mut self, parent: NodeId, child: NodeId, index: u32, ) -> Result<(), SceneError>

Attaches an unattached child at an index.

Source

pub fn remove_child( &mut self, parent: NodeId, child: NodeId, ) -> Result<(), SceneError>

Detaches a direct child without deleting it.

Source

pub fn move_child( &mut self, parent: NodeId, child: NodeId, index: u32, ) -> Result<(), SceneError>

Moves a direct child within its current parent.

Source

pub fn set_layout( &mut self, node: NodeId, geometry: impl Into<LayoutGeometry>, ) -> Result<(), SceneError>

Sets resolved layout when it differs from retained state.

Source

pub fn set_box_paint( &mut self, node: NodeId, paint: BoxPaint, ) -> Result<(), SceneError>

Sets background and border paint when it differs from retained state.

Source

pub fn set_background_layers( &mut self, node: NodeId, layers: Vec<BackgroundLayer>, ) -> Result<(), SceneError>

Sets the ordered background image layers when they differ from retained state. An empty list clears every image while preserving box color.

Source

pub fn set_visual_effects( &mut self, node: NodeId, effects: VisualEffects, ) -> Result<(), SceneError>

Sets resolved visual effects when they differ from retained state.

Source

pub fn set_clip( &mut self, node: NodeId, clip: BoxClip, ) -> Result<(), SceneError>

Sets descendant overflow clipping when it differs from retained state.

Source

pub fn set_transform( &mut self, node: NodeId, transform: Transform, ) -> Result<(), SceneError>

Sets a resolved transform when it differs from retained state.

Source

pub fn set_opacity( &mut self, node: NodeId, opacity: f32, ) -> Result<(), SceneError>

Sets resolved opacity when it differs from retained state.

Source

pub fn set_visibility( &mut self, node: NodeId, visibility: Visibility, ) -> Result<(), SceneError>

Sets resolved visibility when it differs from retained state.

Source

pub fn set_z_order( &mut self, node: NodeId, z_order: i32, ) -> Result<(), SceneError>

Sets resolved stacking order when it differs from retained state.

Source

pub fn set_text( &mut self, node: NodeId, content: TextContent, ) -> Result<(), SceneError>

Sets plain-text presentation when it differs from retained state.

Source

pub fn set_text_style( &mut self, node: NodeId, style: TextStyleSnapshot, ) -> Result<(), SceneError>

Sets a resolved inherited text-style snapshot when it differs from retained state.

Source

pub fn set_property( &mut self, node: NodeId, property: PropertyId, value: WhiskerValue, ) -> Result<(), SceneError>

Sets a typed property when it differs from retained state.

Source

pub fn clear_property( &mut self, node: NodeId, property: PropertyId, ) -> Result<(), SceneError>

Clears a typed property when it is present.

Source

pub fn set_event_mask( &mut self, node: NodeId, event_mask: u64, ) -> Result<(), SceneError>

Sets a node’s event subscription mask.

Source

pub fn set_accessibility( &mut self, node: NodeId, accessibility: Accessibility, ) -> Result<(), SceneError>

Replaces a node’s common accessibility semantics.

Source

pub fn set_hit_test( &mut self, node: NodeId, behavior: HitTestBehavior, ) -> Result<(), SceneError>

Sets a node’s Host hit-test participation.

Source

pub fn update_host_scroll_offset( &mut self, node: NodeId, offset: [f32; 2], ) -> Result<(), SceneError>

Updates transient Host-owned scroll state without producing a frame operation.

Native scrolling advances independently of frame delivery. Retaining its latest logical offset keeps Rust input routing aligned with the pixels the Host currently presents while leaving Rust-authored layout unchanged.

Source

pub fn set_cursor( &mut self, node: NodeId, cursor: Cursor, ) -> Result<(), SceneError>

Sets a node’s resolved pointing-device cursor.

Source

pub fn set_pointer_capture( &mut self, node: NodeId, pointer: PointerId, ) -> Result<(), SceneError>

Captures a pointer when it is not already captured by this node.

Source

pub fn release_pointer_capture( &mut self, node: NodeId, pointer: PointerId, ) -> Result<(), SceneError>

Releases a pointer when it is currently captured by this node.

Source

pub fn release_pointer_captures(&mut self) -> Result<(), SceneError>

Releases every captured pointer.

Source

pub fn invoke_command( &mut self, node: NodeId, command: CommandId, arguments: WhiskerValue, ) -> Result<(), SceneError>

Queues an element command after preceding visual mutations.

Source

pub fn prepare_frame( &mut self, viewport_epoch: u32, ) -> Result<Option<&FramePacket>, SceneError>

Prepares the next snapshot or delta and keeps it pending.

Returns Ok(None) when the accepted scene is idle. Repeated calls while a packet is pending return SceneError::FramePending; the caller must first accept or discard that packet.

Source

pub fn accept_pending(&mut self, revision: u64) -> Result<(), SceneError>

Commits the pending packet after renderer acceptance.

Source

pub fn discard_pending(&mut self) -> Result<(), SceneError>

Discards a prepared packet after a transport or renderer failure.

Retained mutations remain dirty, so the next preparation retries the same semantic work with a new diagnostic frame ID.

Source

pub fn require_snapshot(&mut self) -> Result<(), SceneError>

Switches the next frame to a full snapshot with a new scene epoch.

This is called after a renderer returns NeedSnapshot. Any pending delta is discarded, while retained state and queued commands remain.

Trait Implementations§

Source§

impl Clone for Scene

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Scene

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Forget for Scene

§

impl Freeze for Scene

§

impl Move for Scene

§

impl RefUnwindSafe for Scene

§

impl Send for Scene

§

impl Sync for Scene

§

impl Unpin for Scene

§

impl UnsafeUnpin for Scene

§

impl UnwindSafe for Scene

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.