LayoutPolicy

Trait LayoutPolicy 

Source
pub trait LayoutPolicy:
    Send
    + Sync
    + Clone
    + PartialEq
    + 'static {
    // Required method
    fn measure(
        &self,
        input: &LayoutInput<'_>,
        output: &mut LayoutOutput<'_>,
    ) -> Result<ComputedData, MeasurementError>;

    // Provided methods
    fn measure_eq(&self, other: &Self) -> bool { ... }
    fn placement_eq(&self, other: &Self) -> bool { ... }
    fn place_children(
        &self,
        _input: &PlacementInput<'_>,
        _output: &mut LayoutOutput<'_>,
    ) -> bool { ... }
}
Expand description

Pure layout policy for measuring and placing child nodes.

Required Methods§

Source

fn measure( &self, input: &LayoutInput<'_>, output: &mut LayoutOutput<'_>, ) -> Result<ComputedData, MeasurementError>

Computes layout for the current node.

Provided Methods§

Source

fn measure_eq(&self, other: &Self) -> bool

Compares measurement-relevant state for layout dirty tracking.

Source

fn placement_eq(&self, other: &Self) -> bool

Compares placement-relevant state for layout dirty tracking.

Source

fn place_children( &self, _input: &PlacementInput<'_>, _output: &mut LayoutOutput<'_>, ) -> bool

Recomputes child placements using cached child measurements.

Returns true when the placement pass was handled without remeasurement.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§