pub trait LayoutPolicy:
Send
+ Sync
+ Clone
+ PartialEq
+ 'static {
// Required method
fn measure(
&self,
scope: &MeasureScope<'_>,
) -> Result<LayoutResult, MeasurementError>;
// Provided methods
fn measure_eq(&self, other: &Self) -> bool { ... }
fn placement_eq(&self, other: &Self) -> bool { ... }
fn place_children(
&self,
_scope: &PlacementScope<'_>,
) -> Option<Vec<(u64, PxPosition)>> { ... }
}Expand description
Pure layout policy for measuring and placing child nodes.
Required Methods§
Sourcefn measure(
&self,
scope: &MeasureScope<'_>,
) -> Result<LayoutResult, MeasurementError>
fn measure( &self, scope: &MeasureScope<'_>, ) -> Result<LayoutResult, MeasurementError>
Computes layout for the current node.
Provided Methods§
Sourcefn measure_eq(&self, other: &Self) -> bool
fn measure_eq(&self, other: &Self) -> bool
Compares measurement-relevant state for layout dirty tracking.
Sourcefn placement_eq(&self, other: &Self) -> bool
fn placement_eq(&self, other: &Self) -> bool
Compares placement-relevant state for layout dirty tracking.
Sourcefn place_children(
&self,
_scope: &PlacementScope<'_>,
) -> Option<Vec<(u64, PxPosition)>>
fn place_children( &self, _scope: &PlacementScope<'_>, ) -> Option<Vec<(u64, PxPosition)>>
Recomputes child placements using cached child measurements.
Returns placements 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.