Skip to main content

Layout

Trait Layout 

Source
pub trait Layout {
    // Required methods
    fn measure(
        &self,
        children: &[DesiredSize],
        constraints: SizeConstraints,
    ) -> DesiredSize;
    fn arrange(&self, children: &[DesiredSize], area: Rect) -> Vec<Rect>;
}
Expand description

Trait implemented by all layout algorithms.

A layout receives a set of child sizes and an available area, then computes the final Rect for each child.

Required Methods§

Source

fn measure( &self, children: &[DesiredSize], constraints: SizeConstraints, ) -> DesiredSize

Compute the desired size of this layout given child sizes and constraints.

Source

fn arrange(&self, children: &[DesiredSize], area: Rect) -> Vec<Rect>

Arrange children within the given area, returning a positioned rect per child.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§