pub trait LayoutModifierNode:
Send
+ Sync
+ 'static {
// Provided methods
fn measure(
&self,
_scope: &mut MeasureScope<'_>,
) -> Result<LayoutResult, MeasurementError> { ... }
fn measure_content(
&self,
_input: &LayoutModifierInput<'_>,
_child: &mut dyn LayoutModifierChild,
) -> Result<LayoutResult, MeasurementError> { ... }
fn measure_eq(&self, other: &Self) -> bool
where Self: Sized + PartialEq { ... }
fn placement_eq(&self, other: &Self) -> bool
where Self: Sized + PartialEq { ... }
fn place_children(
&self,
_scope: &PlacementScope<'_>,
_inner: &PlacementResult,
) -> Option<PlacementResult> { ... }
}Expand description
A node-local layout modifier.
This is the single layout measurement contract shared by the innermost
layout node (the measure policy applied at the innermost layer) and by
wrapping layout modifiers. A node overrides either Self::measure (pure
measure, applied at the innermost layer) or Self::measure_content
(wrapping measure). An innermost node may override Self::place_children
to update placements against cached child sizes. Wrapping modifiers can be
measured again around that cached result to update their content bounds.
Provided Methods§
Sourcefn measure(
&self,
_scope: &mut MeasureScope<'_>,
) -> Result<LayoutResult, MeasurementError>
fn measure( &self, _scope: &mut MeasureScope<'_>, ) -> Result<LayoutResult, MeasurementError>
Computes layout for this node when it is applied at the innermost layer.
Sourcefn measure_content(
&self,
_input: &LayoutModifierInput<'_>,
_child: &mut dyn LayoutModifierChild,
) -> Result<LayoutResult, MeasurementError>
fn measure_content( &self, _input: &LayoutModifierInput<'_>, _child: &mut dyn LayoutModifierChild, ) -> Result<LayoutResult, MeasurementError>
Measures and places the wrapped content.
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<'_>,
_inner: &PlacementResult,
) -> Option<PlacementResult>
fn place_children( &self, _scope: &PlacementScope<'_>, _inner: &PlacementResult, ) -> Option<PlacementResult>
Recomputes child placements from cached child sizes.
An innermost layout node derives placements from the cached child sizes
in scope. Returning None means it cannot place without re-measuring.
Wrapping modifiers use Self::measure_content around the cached
result so drawing receives the same content bounds as child
placement.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".