pub struct ContainerCtx<'a> { /* private fields */ }Expand description
Closure context passed into row() / col() closures for accumulating children.
Each method adds a child node (panel, nested container, or grid) to the parent being built. Errors are deferred: the first failure is stored and all subsequent operations become no-ops. The stored error surfaces when the parent builder method returns.
Implementations§
Source§impl ContainerCtx<'_>
impl ContainerCtx<'_>
Sourcepub fn add(&mut self, pid: PanelId)
pub fn add(&mut self, pid: PanelId)
Place a pre-created panel (from LayoutBuilder::panel) into this container.
Sourcepub fn panel(&mut self, kind: impl Into<Arc<str>>) -> PanelId
pub fn panel(&mut self, kind: impl Into<Arc<str>>) -> PanelId
Add a panel child with grow(1.0) default constraints. Returns its PanelId.
Sourcepub fn panel_with(
&mut self,
kind: impl Into<Arc<str>>,
constraints: Constraints,
) -> PanelId
pub fn panel_with( &mut self, kind: impl Into<Arc<str>>, constraints: Constraints, ) -> PanelId
Add a panel child with explicit constraints. Returns its PanelId.
Sourcepub fn row(&mut self, f: impl FnOnce(&mut ContainerCtx<'_>))
pub fn row(&mut self, f: impl FnOnce(&mut ContainerCtx<'_>))
Nest a row container with zero gap. Children are built in the closure.
Sourcepub fn row_gap(&mut self, gap: f32, f: impl FnOnce(&mut ContainerCtx<'_>))
pub fn row_gap(&mut self, gap: f32, f: impl FnOnce(&mut ContainerCtx<'_>))
Nest a row container with the specified gap between children.
Sourcepub fn row_with(
&mut self,
constraints: Constraints,
f: impl FnOnce(&mut ContainerCtx<'_>),
)
pub fn row_with( &mut self, constraints: Constraints, f: impl FnOnce(&mut ContainerCtx<'_>), )
Nest a row container with explicit constraints and zero gap.
Sourcepub fn row_gap_with(
&mut self,
gap: f32,
constraints: Constraints,
f: impl FnOnce(&mut ContainerCtx<'_>),
)
pub fn row_gap_with( &mut self, gap: f32, constraints: Constraints, f: impl FnOnce(&mut ContainerCtx<'_>), )
Nest a row container with explicit constraints and the specified gap.
Sourcepub fn col(&mut self, f: impl FnOnce(&mut ContainerCtx<'_>))
pub fn col(&mut self, f: impl FnOnce(&mut ContainerCtx<'_>))
Nest a column container with zero gap. Children are built in the closure.
Sourcepub fn col_gap(&mut self, gap: f32, f: impl FnOnce(&mut ContainerCtx<'_>))
pub fn col_gap(&mut self, gap: f32, f: impl FnOnce(&mut ContainerCtx<'_>))
Nest a column container with the specified gap between children.
Sourcepub fn col_with(
&mut self,
constraints: Constraints,
f: impl FnOnce(&mut ContainerCtx<'_>),
)
pub fn col_with( &mut self, constraints: Constraints, f: impl FnOnce(&mut ContainerCtx<'_>), )
Nest a column container with explicit constraints and zero gap.
Sourcepub fn col_gap_with(
&mut self,
gap: f32,
constraints: Constraints,
f: impl FnOnce(&mut ContainerCtx<'_>),
)
pub fn col_gap_with( &mut self, gap: f32, constraints: Constraints, f: impl FnOnce(&mut ContainerCtx<'_>), )
Nest a column container with explicit constraints and the specified gap.
Sourcepub fn grid(&mut self, grid: Grid, f: impl FnOnce(&mut GridCtx<'_>))
pub fn grid(&mut self, grid: Grid, f: impl FnOnce(&mut GridCtx<'_>))
Nest a grid container. Grid items are built in the closure via GridCtx.
Sourcepub fn taffy_node(
&mut self,
style: Style,
f: impl FnOnce(&mut ContainerCtx<'_>),
)
pub fn taffy_node( &mut self, style: Style, f: impl FnOnce(&mut ContainerCtx<'_>), )
Insert a raw Taffy node with a custom style. Escape hatch for layouts that cannot be expressed through row/col/grid primitives.