macro_rules! layout {
(row(gap: $gap:expr) { $($children:tt)* }) => { ... };
(row { $($children:tt)* }) => { ... };
(col(gap: $gap:expr) { $($children:tt)* }) => { ... };
(col { $($children:tt)* }) => { ... };
(@root $dir:ident $($children:tt)*) => { ... };
(@root_gap $dir:ident [$gap:expr] $($children:tt)*) => { ... };
(@children $ctx:ident) => { ... };
(@children $ctx:ident panel($kind:expr, grow: $val:expr, min: $min:expr, max: $max:expr) $($rest:tt)*) => { ... };
(@children $ctx:ident panel($kind:expr, grow: $val:expr, min: $min:expr) $($rest:tt)*) => { ... };
(@children $ctx:ident panel($kind:expr, grow: $val:expr, max: $max:expr) $($rest:tt)*) => { ... };
(@children $ctx:ident panel($kind:expr, grow: $val:expr) $($rest:tt)*) => { ... };
(@children $ctx:ident panel($kind:expr, fixed: $val:expr, min: $min:expr, max: $max:expr) $($rest:tt)*) => { ... };
(@children $ctx:ident panel($kind:expr, fixed: $val:expr, min: $min:expr) $($rest:tt)*) => { ... };
(@children $ctx:ident panel($kind:expr, fixed: $val:expr, max: $max:expr) $($rest:tt)*) => { ... };
(@children $ctx:ident panel($kind:expr, fixed: $val:expr) $($rest:tt)*) => { ... };
(@children $ctx:ident panel($kind:expr) $($rest:tt)*) => { ... };
(@children $ctx:ident row(gap: $gap:expr) { $($inner:tt)* } $($rest:tt)*) => { ... };
(@children $ctx:ident row { $($inner:tt)* } $($rest:tt)*) => { ... };
(@children $ctx:ident col(gap: $gap:expr) { $($inner:tt)* } $($rest:tt)*) => { ... };
(@children $ctx:ident col { $($inner:tt)* } $($rest:tt)*) => { ... };
(@nested $ctx:ident $dir:ident { $($inner:tt)* } $($rest:tt)*) => { ... };
(@nested_gap $ctx:ident $dir:ident [$gap:expr] { $($inner:tt)* } $($rest:tt)*) => { ... };
}Expand description
Declarative macro for building layouts from a concise DSL.
Returns Result<Layout, PaneError>.
ยงSyntax
layout! {
row(gap: 8.0) {
panel("editor", grow: 2.0)
col {
panel("chat")
panel("status", fixed: 3.0)
}
}
}- Root must be a single
roworcol. - Containers accept an optional
(gap: N)parameter. - Bare
panel("kind")defaults togrow(1.0). panel("kind", grow: N)andpanel("kind", fixed: N)set constraints.- Panels accept optional
min:andmax:after the primary constraint.