pub struct Layout {
pub common: Common,
pub direction: Option<Direction>,
pub constraints: Vec<Constraint>,
pub children: Vec<Node>,
pub spacing: Option<u16>,
pub margin: Option<Margin>,
pub flex: Option<Flex>,
pub collapse: Option<u16>,
}Expand description
ratatui Layout as a node: data, not geometry (§4.3). There is no split;
children are attached and the renderer solves the main-axis sizes.
Fields§
§common: CommonCommon node props (key, style, block, fallback).
direction: Option<Direction>Main axis (default Vertical).
constraints: Vec<Constraint>One constraint per child; missing ones are Fill(1), extras ignored.
children: Vec<Node>Children (≤ 64, §4.8).
spacing: Option<u16>Gap between children, in cells.
margin: Option<Margin>Inset of the whole area.
flex: Option<Flex>ratatui Flex (default Start).
collapse: Option<u16>Horizontal only: below this many columns, children lay out vertically in
auto mode (§4.3). 0 disables.
Implementations§
Source§impl Layout
impl Layout
Sourcepub fn vertical(constraints: impl IntoIterator<Item = Constraint>) -> Self
pub fn vertical(constraints: impl IntoIterator<Item = Constraint>) -> Self
Vertical layout with one constraint per child.
Sourcepub fn horizontal(constraints: impl IntoIterator<Item = Constraint>) -> Self
pub fn horizontal(constraints: impl IntoIterator<Item = Constraint>) -> Self
Horizontal layout with one constraint per child.
Sourcepub fn constraints(
self,
constraints: impl IntoIterator<Item = Constraint>,
) -> Self
pub fn constraints( self, constraints: impl IntoIterator<Item = Constraint>, ) -> Self
Sets the constraints.
Sourcepub fn children(self, children: impl IntoIterator<Item = Node>) -> Self
pub fn children(self, children: impl IntoIterator<Item = Node>) -> Self
Attaches children (header.into() converts builder values to Node).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Layout
impl<'de> Deserialize<'de> for Layout
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Layout
Source§impl WithCommon for Layout
impl WithCommon for Layout
Source§fn common_mut(&mut self) -> &mut Common
fn common_mut(&mut self) -> &mut Common
Mutable access to the node’s common props.
Source§fn block(self, block: impl Into<BlockProps>) -> Self
fn block(self, block: impl Into<BlockProps>) -> Self
Sets the surrounding block.
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