Skip to main content

LayoutEngine

Trait LayoutEngine 

Source
pub trait LayoutEngine: 'static {
    // Required method
    fn install(self: Box<Self>, app: &mut App);
}
Expand description

A layout engine: what turns the styled tree into absolute boxes.

The engine contributes systems rather than being called per node or per tick. Layout is change-driven (style, children, text, and image changes mark entities dirty) and its state is usually not Send, so the work belongs in ordinary systems in crate::tick::TickStage::LayoutSync the scheduler runs, with change detection, like every other system. The launch dispatches through this trait once, when it installs the engine it selected from crate::layout_backend::LayoutBackends.

The systems that write each entity’s crate::components::Transform go in crate::layout_backend::LayoutSolve, so code that needs this tick’s boxes orders itself after that set without naming an engine.

Required Methods§

Source

fn install(self: Box<Self>, app: &mut App)

Insert the engine’s state and add its systems to app.

Implementors§