pub struct Flex {
pub direction: FlexDirection,
pub children: Vec<Element>,
pub main_axis_alignment: MainAxisAlignment,
pub cross_axis_alignment: CrossAxisAlignment,
pub spacing: f32,
}Expand description
Fields§
§direction: FlexDirectionThe primary layout direction.
children: Vec<Element>Child elements in declaration order.
main_axis_alignment: MainAxisAlignmentHow children are distributed along the main axis.
cross_axis_alignment: CrossAxisAlignmentHow children are aligned on the cross axis.
spacing: f32Pixels of gap between consecutive children.
Implementations§
Source§impl Flex
impl Flex
Sourcepub fn new(direction: FlexDirection) -> Self
pub fn new(direction: FlexDirection) -> Self
Create a new Flex with the given direction and default alignments.
Sourcepub fn spacing(self, s: f32) -> Self
pub fn spacing(self, s: f32) -> Self
Set the gap in logical pixels between consecutive children.
Sourcepub fn main_axis_alignment(self, a: MainAxisAlignment) -> Self
pub fn main_axis_alignment(self, a: MainAxisAlignment) -> Self
Set how children are distributed along the main axis.
Sourcepub fn cross_axis_alignment(self, a: CrossAxisAlignment) -> Self
pub fn cross_axis_alignment(self, a: CrossAxisAlignment) -> Self
Set how children are aligned on the cross axis.
Sourcepub fn layout(
&self,
constraints: Constraints,
child_sizes: &[Size],
) -> LayoutResult
pub fn layout( &self, constraints: Constraints, child_sizes: &[Size], ) -> LayoutResult
Perform the Measure + Place passes and return a LayoutResult.
child_sizes must be in the same order as Self::children.
Emits RosaceTrace::LayoutStart / RosaceTrace::LayoutEnd events.
Trait Implementations§
Source§impl ChildContainer for Flex
impl ChildContainer for Flex
Auto Trait Implementations§
impl !RefUnwindSafe for Flex
impl !UnwindSafe for Flex
impl Freeze for Flex
impl Send for Flex
impl Sync for Flex
impl Unpin for Flex
impl UnsafeUnpin for Flex
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
Mutably borrows from an owned value. Read more