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§
Sourcefn measure(
&self,
input: &LayoutInput<'_>,
output: &mut LayoutOutput<'_>,
) -> Result<ComputedData, MeasurementError>
fn measure( &self, input: &LayoutInput<'_>, output: &mut LayoutOutput<'_>, ) -> Result<ComputedData, 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,
_input: &PlacementInput<'_>,
_output: &mut LayoutOutput<'_>,
) -> bool
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.