Skip to main content

Measurable

Trait Measurable 

Source
pub trait Measurable {
    // Required methods
    fn measure(&self, constraints: Constraints) -> Box<dyn Placeable>;
    fn min_intrinsic_width(&self, height: f32) -> f32;
    fn max_intrinsic_width(&self, height: f32) -> f32;
    fn min_intrinsic_height(&self, width: f32) -> f32;
    fn max_intrinsic_height(&self, width: f32) -> f32;

    // Provided method
    fn flex_parent_data(&self) -> Option<FlexParentData> { ... }
}
Expand description

Object capable of measuring a layout child and exposing intrinsic sizes.

Required Methods§

Source

fn measure(&self, constraints: Constraints) -> Box<dyn Placeable>

Measures the child with the provided constraints, returning a Placeable.

Source

fn min_intrinsic_width(&self, height: f32) -> f32

Returns the minimum width achievable for the given height.

Source

fn max_intrinsic_width(&self, height: f32) -> f32

Returns the maximum width achievable for the given height.

Source

fn min_intrinsic_height(&self, width: f32) -> f32

Returns the minimum height achievable for the given width.

Source

fn max_intrinsic_height(&self, width: f32) -> f32

Returns the maximum height achievable for the given width.

Provided Methods§

Source

fn flex_parent_data(&self) -> Option<FlexParentData>

Returns flex parent data if this measurable has weight/fill properties. Default implementation returns None (no weight).

Implementors§