pub enum Size {
Fixed(f32),
Fill(f32, f32),
Shrink(f32, f32),
}
Expand description
An enum that describes the size and growth behaviour of an element.
Variants§
Fixed(f32)
Element will always have this size.
Fill(f32, f32)
Element tries to grow as big as possible within the given bounds, sharing space equally with other Size::Fill elements.
Shrink(f32, f32)
Element tries to shrink as small as possible within the given bounds, sharing space with other Size::Shrink elements equally only when no other FILL elements are present.
Implementations§
source§impl Size
impl Size
sourcepub fn max(&self) -> f32
pub fn max(&self) -> f32
Returns the maximum amount of space an element of this size can grow to.
sourcepub fn scale(&self, scale: f32) -> Self
pub fn scale(&self, scale: f32) -> Self
Returns a new Size of the same variant, but with all boundaries scaled by the given factor.
sourcepub fn to_shrink(self) -> Self
pub fn to_shrink(self) -> Self
Returns a new Size with the same boundaries, but variant changed to Size::Shrink.
sourcepub fn to_fill(self) -> Self
pub fn to_fill(self) -> Self
Returns a new Size with the same boundaries, but variant changed to Size::Fill.
sourcepub fn to_fixed(self) -> Self
pub fn to_fixed(self) -> Self
Returns a new Size with the same boundaries, but variant changed to Size::Fixed.