pub struct LayoutSpec {Show 20 fields
pub width: Sizing,
pub height: Sizing,
pub min_w: Min,
pub max_w: f32,
pub min_h: Min,
pub max_h: f32,
pub dir: Dir,
pub padding: Edges,
pub gap: f32,
pub wrap: bool,
pub table: bool,
pub cross_gap: f32,
pub main_align: Align,
pub cross_align: Align,
pub aspect: f32,
pub clip: bool,
pub scroll_x: bool,
pub scroll_y: bool,
pub anchor: bool,
pub float: Option<FloatConfig>,
}Expand description
The layout half of a NodeSpec: sizing, clamps, direction, padding,
gap, alignment, overflow and floating. Set through the NodeSpec
builders; read by the solver.
Fields§
§width: Sizing§height: Sizing§min_w: MinClamps applied after width/height resolve (Fit, Grow, Percent and
Fixed alike), so “grow but at most N” and “fit but at least N” work.
A min may also be Min::FIT: “grow but never below my content”.
max_w: f32A ceiling in px, or, as a negative, a size expression layout has
yet to resolve (max_of_calc); set it through
NodeSpec::max_width, which keeps a px one at or above zero
(px_ceiling). max_h is the same.
min_h: Min§max_h: f32§dir: Dir§padding: Edges§gap: f32§wrap: boolRow children that don’t fit the main-axis content box start a new
line instead of overflowing (or shrinking). Rows only: breaking
needs a definite main size, and the pass order gives a row one —
its width is final before its height is measured — where a column
would need its height first. Ignored on a column and on a
scroll_x row, both with a warning (diag::WRAP_IGNORED).
table: boolA column whose rows’ children line up in columns: the nth in-flow
child of every in-flow row is a cell of column n, and
a column is as wide as its widest cell — its cells’ own widths
say how the column sizes (a Fixed or Fit cell is content that
sets the column’s fit width, a Grow cell makes the column grow,
a Percent one takes its cut of the row) and their minWidth /
maxWidth clamp it. The rows are ordinary rows — a row’s gap is
the space between its cells, its padding its own, and it takes
its background, its click and its hover as any row does — except
that a row of a table never wraps (diag::WRAP_IGNORED). Set by
NodeSpec::table, which is a column; dir stays Column, and
the flag is read on a column only (LayoutSpec::is_table): a
Row carrying it — a shape only these public fields can build —
is the row it says it is. The rows are the in-flow Row children;
a column, a table or a leaf straight under the table is a child
with its own width and no cells.
cross_gap: f32Space between wrap lines, across the main axis. gap is still the
space between children along it.
main_align: AlignAlignment of children along the main axis, the spreads
(SpaceBetween / SpaceAround / SpaceEvenly) included.
cross_align: AlignAlignment of children across the main axis; Baseline on a row.
aspect: f32Width over height (CSS’s aspect-ratio); 0 = none.
It sizes the axis whose sizing is Fit: a fit height is the final
width over the ratio, and a fit width under a Fixed height is
that height times it. With both axes declared it has nothing to set.
The derived axis is neither shrunk nor fitted to the children,
which overflow it — min_h: Min::FIT floors it at them.
clip: boolClip children to this node’s rect.
scroll_x: boolOverflowing content scrolls (implies clipping). Offsets are retained
across frames in the core, keyed by this node’s Key.
scroll_y: bool§anchor: boolScroll anchoring (CSS’s overflow-anchor): the
first child in view keeps its place on screen when the content
before it changes size — a chat that prepends history, a log that
inserts above the viewport, a row whose estimate was corrected.
On the scroll axis that is the container’s main axis only.
float: Option<FloatConfig>Out-of-flow positioning; see FloatConfig.
Implementations§
Source§impl LayoutSpec
impl LayoutSpec
Source§impl LayoutSpec
impl LayoutSpec
Trait Implementations§
Source§impl Clone for LayoutSpec
impl Clone for LayoutSpec
Source§fn clone(&self) -> LayoutSpec
fn clone(&self) -> LayoutSpec
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for LayoutSpec
Source§impl Debug for LayoutSpec
impl Debug for LayoutSpec
Source§impl Default for LayoutSpec
impl Default for LayoutSpec
Source§fn default() -> LayoutSpec
fn default() -> LayoutSpec
Source§impl PartialEq for LayoutSpec
impl PartialEq for LayoutSpec
impl StructuralPartialEq for LayoutSpec
Auto Trait Implementations§
impl Freeze for LayoutSpec
impl RefUnwindSafe for LayoutSpec
impl Send for LayoutSpec
impl Sync for LayoutSpec
impl Unpin for LayoutSpec
impl UnsafeUnpin for LayoutSpec
impl UnwindSafe for LayoutSpec
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.