pub enum Flex {
Legacy,
Start,
End,
Center,
SpaceBetween,
SpaceAround,
}Expand description
Controls how free space is distributed along the main axis.
Flex is applied after all constraints are resolved and only affects positioning, not sizing.
The main axis depends on layout direction:
- horizontal → X axis
- vertical → Y axis
Variants§
Legacy
Legacy behavior preserved for backward compatibility.
The exact behavior is implementation-defined and may change.
Start
Packs elements toward the start of the area.
|[A][B][C] |End
Packs elements toward the end of the area.
| [A][B][C]|Center
Centers elements as a group.
| [A][B][C] |SpaceBetween
Distributes free space only between elements.
No gap is added before the first or after the last element.
|[A] [B] [C]|SpaceAround
Distributes free space evenly around all elements.
The gap before the first element, between elements, and after the last element is equal.
| [A] [B] [C] |Trait Implementations§
impl Copy for Flex
impl Eq for Flex
impl StructuralPartialEq for Flex
Auto Trait Implementations§
impl Freeze for Flex
impl RefUnwindSafe for Flex
impl Send for Flex
impl Sync for Flex
impl Unpin for Flex
impl UnsafeUnpin for Flex
impl UnwindSafe 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