pub struct Layout {
pub direction: Direction,
pub constraints: Vec<Constraint>,
pub gap: u16,
}Expand description
A layout specification.
Splits a rectangle into sub-rectangles based on constraints and direction.
Fields§
§direction: Direction§constraints: Vec<Constraint>§gap: u16Gap between areas in cells (0 = no gap).
Implementations§
Source§impl Layout
impl Layout
pub fn new(direction: Direction) -> Self
pub fn constraints(self, constraints: Vec<Constraint>) -> Self
pub fn gap(self, gap: u16) -> Self
Sourcepub fn split(self, area: Rect) -> Vec<Rect>
pub fn split(self, area: Rect) -> Vec<Rect>
Split the given area into sub-rectangles based on the constraints.
The algorithm:
- Calculate the total available space (minus gaps).
- Resolve each constraint into a desired size.
- Distribute remaining space to
Min/Percentageconstraints. - Return the list of rectangles.
Auto Trait Implementations§
impl Freeze for Layout
impl RefUnwindSafe for Layout
impl Send for Layout
impl Sync for Layout
impl Unpin for Layout
impl UnsafeUnpin for Layout
impl UnwindSafe for Layout
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