Skip to main content

LayoutEngine

Struct LayoutEngine 

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

Deterministic cross-platform Flexbox, Grid, Block, and Positioned layout engine.

Implementations§

Source§

impl LayoutEngine

Core layout solver, split cache management, and spatial hit-testing operations for LayoutEngine.

Source

pub fn compute(&mut self, tree: &mut SceneTree, viewport: Size) -> LayoutStats

Computes layout for the entire tree within viewport, skipping clean cached subtrees.

§Arguments
  • &Self - Mutable layout engine.
  • &mut SceneTree - Retained scene tree to lay out.
  • Size - Logical viewport dimensions.
§Returns
  • LayoutStats - Computed vs cached subtree counts.
Source

pub fn layout_telemetry(&self) -> LayoutTelemetry

Returns cumulative LayoutTelemetry counters (invalidations, passes, changed_passes, changed_nodes_total).

§Arguments
  • &Self - Layout engine reference.
§Returns
  • LayoutTelemetry - Cumulative layout telemetry snapshot.
Source

pub fn reset_telemetry(&mut self)

Resets cumulative LayoutTelemetry counters to zero.

§Arguments
  • &Self - Mutable layout engine.
Source

pub fn split_cache_stats(&self) -> SplitCacheStats

Returns per-pass split measure/final layout cache and interval text cache diagnostics.

§Arguments
  • &Self - Layout engine reference.
§Returns
  • SplitCacheStats - Split cache hit/miss diagnostics from the most recent layout pass.
Source

pub fn subtree_bounds(&self, node_id: NodeId) -> Option<Rect>

Returns the cached spatial subtree_bounds computed for node_id, if valid.

§Arguments
  • &Self - Layout engine reference.
  • NodeId - Target scene node handle.
§Returns
  • Option<Rect> - Cached subtree visual/interactive bounding box in root logical coordinates.
Source

pub fn hit_test(&self, tree: &SceneTree, point: Point) -> Option<NodeId>

Performs zero-allocation spatial hit-testing accelerated by cached subtree_bounds and has_nonzero_z_child.

§Arguments
  • &Self - Layout engine reference owning the spatial cache.
  • &SceneTree - Retained scene tree after layout.
  • Point - Logical pointer coordinates in root space.
§Returns
  • Option<NodeId> - Topmost matching node handle, if any.
Source

pub fn hit_test_with_visited( &self, tree: &SceneTree, point: Point, ) -> (Option<NodeId>, usize)

Performs zero-allocation spatial hit-testing and also returns the number of inspected scene nodes.

§Arguments
  • &Self - Layout engine reference owning the spatial cache.
  • &SceneTree - Retained scene tree after layout.
  • Point - Logical pointer coordinates in root space.
§Returns
  • (Option<NodeId>, usize) - Pair of (topmost_hit, nodes_visited).
Source§

impl LayoutEngine

Source

pub fn get_measurer(&self) -> DeterministicTextMeasurer

Source

pub fn get_mut_measurer(&mut self) -> &mut DeterministicTextMeasurer

Source

pub fn set_measurer(&mut self, val: DeterministicTextMeasurer) -> &mut Self

Source

pub fn get_last_stats(&self) -> LayoutStats

Source

pub fn get_mut_last_stats(&mut self) -> &mut LayoutStats

Source

pub fn set_last_stats(&mut self, val: LayoutStats) -> &mut Self

Source

pub fn get_telemetry(&self) -> LayoutTelemetry

Source

pub fn get_mut_telemetry(&mut self) -> &mut LayoutTelemetry

Source

pub fn set_telemetry(&mut self, val: LayoutTelemetry) -> &mut Self

Trait Implementations§

Source§

impl Clone for LayoutEngine

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 LayoutEngine

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for LayoutEngine

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Forget for LayoutEngine

§

impl Freeze for LayoutEngine
where *const u8 is !null: Freeze, PhantomData<NodeId>: Freeze, PhantomData<FlexItemRecord>: Freeze, PhantomData<(usize, usize)>: Freeze, PhantomData<TextSizeEntry>: Freeze, PhantomData<LayoutNodeSnapshot>: Freeze, PhantomData<u32>: Freeze, PhantomData<[MeasureCacheSlot; 4]>: Freeze, PhantomData<Option<FinalLayoutSlot>>: Freeze, PhantomData<NodeTextHashSlot>: Freeze, PhantomData<Rect>: Freeze, PhantomData<u8>: Freeze,

§

impl Move for LayoutEngine

§

impl RefUnwindSafe for LayoutEngine

§

impl Send for LayoutEngine
where RawVecInner: Send,

§

impl Sync for LayoutEngine
where RawVecInner: Sync,

§

impl Unpin for LayoutEngine
where *const u8 is !null: Unpin,

§

impl UnsafeUnpin for LayoutEngine

§

impl UnwindSafe for LayoutEngine
where RawVecInner: UnwindSafe,

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.