Struct layout_2020::flexbox::layout::FlexItem
source · struct FlexItem<'a> {Show 13 fields
box_: &'a FlexItemBox,
content_box_size: FlexRelativeVec2<AuOrAuto>,
content_min_size: FlexRelativeVec2<Au>,
content_max_size: FlexRelativeVec2<Option<Au>>,
padding: FlexRelativeSides<Au>,
border: FlexRelativeSides<Au>,
margin: FlexRelativeSides<AuOrAuto>,
pbm_auto_is_zero: FlexRelativeVec2<Au>,
flex_base_size: Au,
flex_base_size_is_definite: bool,
hypothetical_main_size: Au,
align_self: T,
depends_on_block_constraints: bool,
}
Expand description
A flex item with some intermediate results
Fields§
§box_: &'a FlexItemBox
§content_box_size: FlexRelativeVec2<AuOrAuto>
§content_min_size: FlexRelativeVec2<Au>
§content_max_size: FlexRelativeVec2<Option<Au>>
§padding: FlexRelativeSides<Au>
§border: FlexRelativeSides<Au>
§margin: FlexRelativeSides<AuOrAuto>
§pbm_auto_is_zero: FlexRelativeVec2<Au>
Sum of padding, border, and margin (with auto
assumed to be zero) in each axis.
This is the difference between an outer and inner size.
flex_base_size: Au
§flex_base_size_is_definite: bool
Whether the Self::flex_base_size
comes from a definite flex-basis
.
If false and the container main size is also indefinite, percentages in the item’s
content that resolve against its main size should be indefinite.
hypothetical_main_size: Au
§align_self: T
This is align-self
, defaulting to align-items
if auto
depends_on_block_constraints: bool
Whether or not the size of this FlexItem
depends on its block constraints.
Implementations§
source§impl<'a> FlexItem<'a>
impl<'a> FlexItem<'a>
fn new(flex_context: &FlexContext<'_>, box_: &'a FlexItemBox) -> Self
fn stretches(&self) -> bool
source§impl FlexItem<'_>
impl FlexItem<'_>
sourcefn layout(
&self,
used_main_size: Au,
flex_context: &FlexContext<'_>,
used_cross_size_override: Option<Au>,
non_stretch_layout_result: Option<&mut FlexItemLayoutResult>,
) -> Option<FlexItemLayoutResult>
fn layout( &self, used_main_size: Au, flex_context: &FlexContext<'_>, used_cross_size_override: Option<Au>, non_stretch_layout_result: Option<&mut FlexItemLayoutResult>, ) -> Option<FlexItemLayoutResult>
Return the hypothetical cross size together with laid out contents of the fragment. From https://drafts.csswg.org/css-flexbox/#algo-cross-item:
performing layout as if it were an in-flow block-level box with the used main size and the given available space, treating
auto
asfit-content
.
fn synthesized_baseline_relative_to_margin_box(&self, content_size: Au) -> Au
sourcefn resolve_auto_margins(
&self,
flex_context: &FlexContext<'_>,
line_cross_size: Au,
item_cross_content_size: Au,
space_distributed_to_auto_main_margins: Au,
) -> FlexRelativeSides<Au>
fn resolve_auto_margins( &self, flex_context: &FlexContext<'_>, line_cross_size: Au, item_cross_content_size: Au, space_distributed_to_auto_main_margins: Au, ) -> FlexRelativeSides<Au>
Return the cross-start, cross-end, main-start, and main-end margins, with auto
values resolved.
See:
sourcefn align_along_cross_axis(
&self,
margin: &FlexRelativeSides<Au>,
used_cross_size: &Au,
line_cross_size: Au,
propagated_baseline: Au,
max_propagated_baseline: Au,
wrap_reverse: bool,
) -> Au
fn align_along_cross_axis( &self, margin: &FlexRelativeSides<Au>, used_cross_size: &Au, line_cross_size: Au, propagated_baseline: Au, max_propagated_baseline: Au, wrap_reverse: bool, ) -> Au
Return the coordinate of the cross-start side of the content area
Auto Trait Implementations§
impl<'a> Freeze for FlexItem<'a>
impl<'a> !RefUnwindSafe for FlexItem<'a>
impl<'a> Send for FlexItem<'a>
impl<'a> Sync for FlexItem<'a>
impl<'a> Unpin for FlexItem<'a>
impl<'a> !UnwindSafe for FlexItem<'a>
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