Skip to main content

ContainerCtx

Struct ContainerCtx 

Source
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<'_>

Source

pub fn add(&mut self, pid: PanelId)

Place a pre-created panel (from LayoutBuilder::panel) into this container.

Source

pub fn panel(&mut self, kind: impl Into<Arc<str>>) -> PanelId

Add a panel child with grow(1.0) default constraints. Returns its PanelId.

Source

pub fn panel_with( &mut self, kind: impl Into<Arc<str>>, constraints: Constraints, ) -> PanelId

Add a panel child with explicit constraints. Returns its PanelId.

Source

pub fn row(&mut self, f: impl FnOnce(&mut ContainerCtx<'_>))

Nest a row container with zero gap. Children are built in the closure.

Source

pub fn row_gap(&mut self, gap: f32, f: impl FnOnce(&mut ContainerCtx<'_>))

Nest a row container with the specified gap between children.

Source

pub fn row_with( &mut self, constraints: Constraints, f: impl FnOnce(&mut ContainerCtx<'_>), )

Nest a row container with explicit constraints and zero gap.

Source

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.

Source

pub fn col(&mut self, f: impl FnOnce(&mut ContainerCtx<'_>))

Nest a column container with zero gap. Children are built in the closure.

Source

pub fn col_gap(&mut self, gap: f32, f: impl FnOnce(&mut ContainerCtx<'_>))

Nest a column container with the specified gap between children.

Source

pub fn col_with( &mut self, constraints: Constraints, f: impl FnOnce(&mut ContainerCtx<'_>), )

Nest a column container with explicit constraints and zero gap.

Source

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.

Source

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.

Source

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.

Auto Trait Implementations§

§

impl<'a> Freeze for ContainerCtx<'a>

§

impl<'a> RefUnwindSafe for ContainerCtx<'a>

§

impl<'a> !Send for ContainerCtx<'a>

§

impl<'a> !Sync for ContainerCtx<'a>

§

impl<'a> Unpin for ContainerCtx<'a>

§

impl<'a> UnsafeUnpin for ContainerCtx<'a>

§

impl<'a> !UnwindSafe for ContainerCtx<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.