pub struct Constraints {
pub min_width: f32,
pub max_width: AxisBound,
pub min_height: f32,
pub max_height: AxisBound,
}Expand description
Layout constraints passed down the render tree during the measure pass.
See also the helper methods added in rosace-core:
Constraints::max_width_f32Constraints::max_height_f32Constraints::constrainConstraints::is_tightLayout constraints passed down the render tree during the measure pass.
Distinct from rosace_trace::event::TraceConstraints, which is a
simplified snapshot for tracing purposes only.
Fields§
§min_width: f32Minimum allowed width in logical pixels.
max_width: AxisBoundMaximum allowed width.
min_height: f32Minimum allowed height in logical pixels.
max_height: AxisBoundMaximum allowed height.
Implementations§
Source§impl Constraints
impl Constraints
Sourcepub fn loose(width: f32, height: f32) -> Constraints
pub fn loose(width: f32, height: f32) -> Constraints
Loose constraints: minimum is zero, maximum is the given dimensions.
The child may be any size up to width × height.
Sourcepub fn tight(width: f32, height: f32) -> Constraints
pub fn tight(width: f32, height: f32) -> Constraints
Tight constraints: minimum equals maximum at the given dimensions.
The child must be exactly width × height.
Sourcepub fn unbounded() -> Constraints
pub fn unbounded() -> Constraints
Fully unbounded constraints: the child may take any size on both axes.
Sourcepub fn max_width_f32(&self) -> f32
pub fn max_width_f32(&self) -> f32
Returns the maximum width as f32, or f32::INFINITY if the axis is
unbounded or shrink-to-fit.
Sourcepub fn max_height_f32(&self) -> f32
pub fn max_height_f32(&self) -> f32
Returns the maximum height as f32, or f32::INFINITY if the axis is
unbounded or shrink-to-fit.
Trait Implementations§
Source§impl Clone for Constraints
impl Clone for Constraints
Source§fn clone(&self) -> Constraints
fn clone(&self) -> Constraints
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more