#[non_exhaustive]pub enum Justify {
Start,
Center,
End,
SpaceBetween,
SpaceAround,
SpaceEvenly,
}Expand description
Distribution of free space along a container’s main axis.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Start
Pack items at the start of the line.
Center
Center items as a group.
End
Pack items at the end of the line.
SpaceBetween
Spread items so the first and last touch the edges.
SpaceAround
Give every item equal space on both sides.
SpaceEvenly
Give every item equal space, including the outer edges.
Implementations§
Source§impl Justify
impl Justify
Sourcepub fn distribute(self, count: usize, _base_gap: f32, extra: f32) -> (f32, f32)
pub fn distribute(self, count: usize, _base_gap: f32, extra: f32) -> (f32, f32)
Computes the leading offset and the gap added between items.
extra is the free space to distribute and is clamped to zero for
invalid values.
Sourcepub fn start_offset(self, extra: f32) -> f32
pub fn start_offset(self, extra: f32) -> f32
Returns only the leading offset produced by Justify::distribute.
Trait Implementations§
impl Copy for Justify
impl Eq for Justify
impl StructuralPartialEq for Justify
Auto Trait Implementations§
impl Freeze for Justify
impl RefUnwindSafe for Justify
impl Send for Justify
impl Sync for Justify
impl Unpin for Justify
impl UnsafeUnpin for Justify
impl UnwindSafe for Justify
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