pub trait MeasurePolicy {
// Required methods
fn measure(
&self,
scope: &dyn MeasureScope,
measurables: &[Box<dyn Measurable>],
constraints: Constraints,
) -> MeasureResult;
fn min_intrinsic_width(
&self,
measurables: &[Box<dyn Measurable>],
height: f32,
) -> f32;
fn max_intrinsic_width(
&self,
measurables: &[Box<dyn Measurable>],
height: f32,
) -> f32;
fn min_intrinsic_height(
&self,
measurables: &[Box<dyn Measurable>],
width: f32,
) -> f32;
fn max_intrinsic_height(
&self,
measurables: &[Box<dyn Measurable>],
width: f32,
) -> f32;
// Provided methods
fn measure_into(
&self,
scope: &dyn MeasureScope,
measurables: &[Box<dyn Measurable>],
constraints: Constraints,
placements: &mut Vec<Placement>,
) -> Measurement { ... }
fn measure_hold(
&self,
_measurables: &[Box<dyn Measurable>],
_constraints: Constraints,
_size: Size,
) -> Option<ConstraintsHold> { ... }
}Expand description
Policy responsible for measuring and placing children.
Required Methods§
Sourcefn measure(
&self,
scope: &dyn MeasureScope,
measurables: &[Box<dyn Measurable>],
constraints: Constraints,
) -> MeasureResult
fn measure( &self, scope: &dyn MeasureScope, measurables: &[Box<dyn Measurable>], constraints: Constraints, ) -> MeasureResult
Runs the measurement pass with the provided children and constraints.
Sourcefn min_intrinsic_width(
&self,
measurables: &[Box<dyn Measurable>],
height: f32,
) -> f32
fn min_intrinsic_width( &self, measurables: &[Box<dyn Measurable>], height: f32, ) -> f32
Computes the minimum intrinsic width of this policy.
Sourcefn max_intrinsic_width(
&self,
measurables: &[Box<dyn Measurable>],
height: f32,
) -> f32
fn max_intrinsic_width( &self, measurables: &[Box<dyn Measurable>], height: f32, ) -> f32
Computes the maximum intrinsic width of this policy.
Sourcefn min_intrinsic_height(
&self,
measurables: &[Box<dyn Measurable>],
width: f32,
) -> f32
fn min_intrinsic_height( &self, measurables: &[Box<dyn Measurable>], width: f32, ) -> f32
Computes the minimum intrinsic height of this policy.
Sourcefn max_intrinsic_height(
&self,
measurables: &[Box<dyn Measurable>],
width: f32,
) -> f32
fn max_intrinsic_height( &self, measurables: &[Box<dyn Measurable>], width: f32, ) -> f32
Computes the maximum intrinsic height of this policy.
Provided Methods§
Sourcefn measure_into(
&self,
scope: &dyn MeasureScope,
measurables: &[Box<dyn Measurable>],
constraints: Constraints,
placements: &mut Vec<Placement>,
) -> Measurement
fn measure_into( &self, scope: &dyn MeasureScope, measurables: &[Box<dyn Measurable>], constraints: Constraints, placements: &mut Vec<Placement>, ) -> Measurement
Runs measurement into caller-owned placement storage.
The default preserves the public MeasurePolicy::measure contract for custom
policies. Built-in policies override this to avoid allocating a fresh placement
vector on every measure pass.
Sourcefn measure_hold(
&self,
_measurables: &[Box<dyn Measurable>],
_constraints: Constraints,
_size: Size,
) -> Option<ConstraintsHold>
fn measure_hold( &self, _measurables: &[Box<dyn Measurable>], _constraints: Constraints, _size: Size, ) -> Option<ConstraintsHold>
The incoming constraints the measure that sized the layout size
under constraints holds for, when the policy can tell: see
crate::ConstraintsHold. None, the default, holds for
constraints alone.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".