Skip to main content

GridCtx

Struct GridCtx 

Source
pub struct GridCtx<'a> { /* private fields */ }
Expand description

Closure context passed into grid() closures for accumulating grid children.

Supports plain panels, panels with column spans, and nested row/col/grid containers. 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 GridCtx<'_>

Source

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

Add a grid item panel 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 grid item panel with explicit constraints. Returns its PanelId.

Source

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

Add a grid item panel with a column span and grow(1.0) default constraints. Returns its PanelId.

Source

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

Add a grid item panel with explicit constraints and a column span. 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 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 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_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 a new GridCtx.

Auto Trait Implementations§

§

impl<'a> Freeze for GridCtx<'a>

§

impl<'a> RefUnwindSafe for GridCtx<'a>

§

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

§

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

§

impl<'a> Unpin for GridCtx<'a>

§

impl<'a> UnsafeUnpin for GridCtx<'a>

§

impl<'a> !UnwindSafe for GridCtx<'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.