pub struct Layout { /* private fields */ }Expand description
Defines a horizontal and vertical grid layout setup.
Layout is used for separating a given total space (e.g., the window size)
into easy-to-manage rectangular chunks for rendering UI elements.
Implementations§
Source§impl Layout
impl Layout
Sourcepub fn row(
self,
height_constraint: Constraint,
width_constraints: Vec<Constraint>,
) -> Self
pub fn row( self, height_constraint: Constraint, width_constraints: Vec<Constraint>, ) -> Self
Adds a new row to the layout with specified height and column width constraints.
Sourcepub fn empty_row(self, constraint: Constraint) -> Self
pub fn empty_row(self, constraint: Constraint) -> Self
Creates a row that takes up the full width of the available space with a single height constraint.
Sourcepub fn calculate(
self,
space: impl Into<Vec2>,
) -> Result<Vec<Vec<Rect>>, LayoutError>
pub fn calculate( self, space: impl Into<Vec2>, ) -> Result<Vec<Vec<Rect>>, LayoutError>
Calculates the Rects for all elements in the layout based on the total available space.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Layout
impl RefUnwindSafe for Layout
impl Send for Layout
impl Sync for Layout
impl Unpin 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