Struct layout_2013::flex::FlexItem
source · struct FlexItem {
pub main_size: Au,
pub base_size: Au,
pub min_size: Au,
pub max_size: Au,
pub index: usize,
pub flex_grow: f32,
pub flex_shrink: f32,
pub order: i32,
pub is_frozen: bool,
pub is_strut: bool,
}
Expand description
Represents a child in a flex container. Most fields here are used in flex size resolving, and items are sorted by the ‘order’ property.
Fields§
§main_size: Au
Main size of a flex item, used to store results of flexible length calcuation.
base_size: Au
Used flex base size.
min_size: Au
The minimal size in main direction.
max_size: Au
The maximal main size. If this property is not actually set by style It will be the largest size available for code reuse.
index: usize
The index of the actual flow in our child list.
flex_grow: f32
The ‘flex-grow’ property of this item.
flex_shrink: f32
The ‘flex-shrink’ property of this item.
order: i32
The ‘order’ property of this item.
is_frozen: bool
Whether the main size has met its constraint.
is_strut: bool
True if this flow has property ‘visibility::collapse’.
Implementations§
source§impl FlexItem
impl FlexItem
pub fn new(index: usize, flow: &dyn Flow) -> FlexItem
sourcepub fn init_sizes(
&mut self,
flow: &mut dyn Flow,
containing_length: Au,
direction: Direction,
)
pub fn init_sizes( &mut self, flow: &mut dyn Flow, containing_length: Au, direction: Direction, )
Initialize the used flex base size, minimal main size and maximal main size. For block mode container this method should be called in assign_block_size() pass so that the item has already been layouted.
sourcepub fn outer_main_size(&self, flow: &dyn Flow, direction: Direction) -> Au
pub fn outer_main_size(&self, flow: &dyn Flow, direction: Direction) -> Au
Returns the outer main size of the item, including paddings and margins, clamped by max and min size.
sourcepub fn auto_margin_count(&self, flow: &dyn Flow, direction: Direction) -> i32
pub fn auto_margin_count(&self, flow: &dyn Flow, direction: Direction) -> i32
Returns the number of auto margins in given direction.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FlexItem
impl RefUnwindSafe for FlexItem
impl Send for FlexItem
impl Sync for FlexItem
impl Unpin for FlexItem
impl UnwindSafe for FlexItem
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more