pub enum Constraint {
Percentage(f32),
Fixed(u16),
Range {
min: u16,
max: u16,
},
Min(u16),
Max(u16),
Flexible,
}Expand description
Defines a constraint for sizing elements within a layout.
Constraints determine how much space an element should occupy relative to the available space or other elements.
Variants§
Percentage(f32)
Takes up a specified percentage of the total available space (0.0 to 100.0). It will shrink if necessary to fit within the available space.
Fixed(u16)
Takes up a fixed amount of space in units (e.g., characters or rows). If the available space is less than the fixed size, an error may occur.
Range
Takes up space within a specified minimum and maximum range.
It will try to fit its content but won’t go below min or above max.
Min(u16)
Takes up at least the specified minimum space, but can grow beyond it.
Max(u16)
Takes up at most the specified maximum space, but can shrink below it.
Flexible
Takes up all the remaining available space after other constraints have been resolved. Multiple flexible constraints will share the remaining space evenly.
Trait Implementations§
Source§impl Clone for Constraint
impl Clone for Constraint
Source§fn clone(&self) -> Constraint
fn clone(&self) -> Constraint
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more