API reference

aster_blueprint::layout

Pre-1.0: signatures are not frozen. Generated from rustdoc JSON of the compiled crate; rustdoc JSON format version 60. Only public items are listed.

Content-driven layout: containers, flex, wrap, grid, overlay, scroll and baseline alignment, solved by one deterministic pass over a [Node] tree.

This is a compiled layout pass (pure Rust, no graph kernels): build a tree with the terse builders, call [Node::solve] with a [TextMeasure] and read rectangles back by id ([Solved::rect]) or as graph parameters ([Solved::params], LogicalLength literals named prefix.id.x|y|w|h). Text nodes are measured by the pass itself (see text_measure).

use aster_blueprint::layout::*;
let ui = col().gap(8.).pad(12.).align(Align::Stretch).children([
    bx(100., 20.).id("a"),
    row().gap(4.).children([bx(30., 10.).id("b"), spacer(), bx(30., 10.).id("c")]).id("r"),
]);
let solved = ui.solve_boxes(200., 100.).unwrap();
assert_eq!(solved.rect("c").unwrap().x, 200. - 12. - 30.);

Semantics (all lengths logical, all sizes border-box):

  • Auto size = natural (content) size; w/h/size set it exactly; min/max clamp. min > max is refused ([LayoutError::MinExceedsMax]).
  • Flex: base = natural main size, then grow shares positive free space, shrink (weighted by base) removes overflow, each stopping at min/max. Item min defaults to 0 (no automatic content minimum). Remaining free space is distributed by [Justify]; when items still overflow, they overflow towards the end (justify acts as Start) and the container reports it in [Placed::overflow].
  • Cross axis: container [Align], overridable per child with align_self / place. Stretch only affects children whose cross size is Auto. Baseline aligns text/boxes in a row by baseline (elsewhere it is Start).
  • Wrap: greedy line breaking on the main axis; a wrap container whose width

(documentation continues in the source)

Structs

structaster_blueprint::layout::Anchor

pub struct Anchor { /* see fields */ }

Where an anchored child sits inside its parent's padding box. An edge left None is free; both edges of an axis stretch the child between them.

left / right / top / bottom are physical: they stay where they are in every direction. start / end are logical: start is the left edge in a left-to-right subtree and the right edge in a right-to-left one (of the anchored child's own direction). A physical edge wins over its logical twin.

Public fields

fieldtype
leftOption<Len>
topOption<Len>
rightOption<Len>
bottomOption<Len>
startOption<Len>The inline-start edge (the left in LTR, the right in RTL).
endOption<Len>The inline-end edge (the right in LTR, the left in RTL).

Trait implementations: Clone, Debug, Default, PartialEq, StructuralPartialEq

structaster_blueprint::layout::ContainerFn

pub struct ContainerFn(..)

Builds the child of a container query from the container's resolved size (its content box, in logical px).

Trait implementations: Clone, Debug

structaster_blueprint::layout::Deco

pub struct Deco { /* see fields */ }

The decoration of a run: lines drawn in the run's colour and a background, none of which touches the layout.

Public fields

fieldtype
underlinebool
strikebool
bgOption<[u8; 4]>The background behind the run (sRGB, straight alpha).

Methods

  • fn is_none(&self) -> bool

Trait implementations: Clone, Copy, Debug, Default, PartialEq, StructuralPartialEq

structaster_blueprint::layout::Insets

pub struct Insets { /* see fields */ }

Safe-area insets (logical px): the edges a display cuts into (a notch, a rounded corner, an overscan border).

Public fields

fieldtype
lf64
tf64
rf64
bf64

Methods

  • const ZERO: Insets — No insets.
  • fn all(v: f64) -> Self — The same inset on all four sides.
  • const fn new(l: f64, t: f64, r: f64, b: f64) -> Self — Left, top, right, bottom.
  • const fn uniform(v: f64) -> Self — The same inset on all four sides (same as [Insets::all]).
  • fn is_zero(&self) -> bool — Whether every edge is exactly 0.
  • fn horizontal(&self) -> f64 — Left and right together.
  • fn vertical(&self) -> f64 — Top and bottom together.
  • fn max(self, o: Insets) -> Insets — The edge-wise maximum of two insets.
  • fn sanitized(self) -> Insets — Every edge finite and >= 0 (NaN, infinity and negative values become 0).
  • fn rotated_cw(self) -> Insets — The insets after the surface is turned a quarter turn clockwise (the top edge becomes the right edge, the right the bottom, the bottom the left, the left the top).
  • fn shrink(self, r: Rect) -> Rect — The safe rectangle inside r (never smaller than zero).

Trait implementations: Clone, Copy, Debug, Default, PartialEq, StructuralPartialEq

structaster_blueprint::layout::LenCtx

pub struct LenCtx { /* see fields */ }

The environment a layout resolves its lengths against: the viewport, the device scale, the type scale and the safe area. vw/vh are 0 when the viewport is unknown; scale is device pixels per logical pixel.

Public fields

fieldtype
vwf64Viewport width in logical px (0 = unknown).
vhf64Viewport height in logical px (0 = unknown).
scalef64Device pixels per logical pixel (1 = unscaled).
emf64The em size (logical px).
remf64The rem size (logical px).
safeInsetsThe safe area (notch, rounded corners, overscan).

Methods

  • const fn new(vw: f64, vh: f64, scale: f64, em: f64, rem: f64, safe: Insets) -> Self — A context from its parts.
  • fn with_root(self, rem: f64) -> Self — The same context with a different root font size.
  • fn sanitized(&self) -> LenCtx — The context with every unusable number replaced: a non-finite or negative viewport side becomes 0 (unknown), a non-positive scale 1, a non-finite or negative em / rem 16, a bad inset 0.
  • fn dp_scale(&self) -> f64 — The factor that turns a device-independent length into the space the solver works in. The solver works in logical pixels, so it is 1.0; a solver that lays out in device pixels multiplies by [LenCtx::scale].

Trait implementations: Clone, Copy, Debug, Default, PartialEq, StructuralPartialEq

structaster_blueprint::layout::Node

pub struct Node { /* see fields */ }

One layout node. Build with [col], [row], [wrap], [grid], [overlay], [scroll], [bx], [spacer], [text] and the chained setters; the first invalid setter is remembered and reported by solve.

Methods

  • fn id(self, id: &str) -> Self
  • fn size(self, w: f64, h: f64) -> Self
  • fn size_len(self, w: Len, h: Len) -> Self — Width and height as lengths (percentages, viewport units, em...).
  • fn w(self, w: f64) -> Self
  • fn w_len(self, w: Len) -> Self — Width as a length (resolved at layout time).
  • fn h(self, h: f64) -> Self
  • fn h_len(self, h: Len) -> Self — Height as a length (resolved at layout time).
  • fn min_w(self, v: f64) -> Self
  • fn min_h(self, v: f64) -> Self
  • fn max_w(self, v: f64) -> Self
  • fn max_h(self, v: f64) -> Self
  • fn min_w_len(self, v: Len) -> Self — Minimum width as a length.
  • fn min_h_len(self, v: Len) -> Self — Minimum height as a length.
  • fn max_w_len(self, v: Len) -> Self — Maximum width as a length.
  • fn max_h_len(self, v: Len) -> Self — Maximum height as a length.
  • fn grow(self, g: f64) -> Self
  • fn shrink(self, s: f64) -> Self
  • fn min_content(self) -> Self — Opt in: a row never shrinks this child below its min-content width, and a column never makes it narrower than that (the cross-axis floor; the column overflows). The width is (the longest word of a wrapped text, the widest or summed min-content of its children for a container), so a paragraph beside a rigid sibling wraps at words and the row overflows instead of breaking inside a word. In a grid, an overflowing grid shrinks the auto column of a flagged cell down to it. A fixed min_w still wins when it is larger.
  • fn basis(self, px: f64) -> Self — flex-basis: the main-axis size (width in a row, height in a column) the flex distribution starts from instead of the content's natural size, so grow and shrink share the space around it. basis(0.) with grow(1.) splits a row by the weights alone, whatever the content (the w(0.).grow(n) idiom, without fixing the width). Clamped by min_w/max_w as the flex size is; a text wraps at it.
  • fn rigid(self) -> Self — Never shrink (shrink(0)).
  • fn fill(self) -> Self — grow(1) and stretch on both axes (if the sizes are Auto).
  • fn align_content(self, j: Justify) -> Self — align-content: where the lines of a wrapping row/column sit when the container has a definite cross size (Start by default: packed at the start). Center, End and the Space* values spread the free cross space over the lines the way justify spreads it over the items.
  • fn align(self, a: Align) -> Self — Container: cross-axis alignment of children (grid/overlay: both axes).
  • fn justify(self, j: Justify) -> Self
  • fn gap(self, g: f64) -> Self — Gap between items (and between wrap lines / grid rows and columns).
  • fn gap_xy(self, gx: f64, gy: f64) -> Self — Horizontal gap gx (between columns) and vertical gap gy (rows).
  • fn gap_len(self, gx: Len, gy: Len) -> Self — Gap as lengths (resolved at layout time).
  • fn pad(self, p: f64) -> Self
  • fn pad_xy(self, x: f64, y: f64) -> Self
  • fn pad4(self, l: f64, t: f64, r: f64, b: f64) -> Self — Left, top, right, bottom.
  • fn pad_len(self, l: Len, t: Len, r: Len, b: Len) -> Self — Padding as lengths: left, top, right, bottom.
  • fn pad_start(self, v: f64) -> Self — The padding on the inline-start edge (the left in LTR, the right in RTL): pad_start(8.).
  • fn pad_end(self, v: f64) -> Self — The padding on the inline-end edge (the right in LTR, the left in RTL): pad_end(8.).
  • fn dir(self, d: Direction) -> Self — The reading direction of this subtree: dir(Direction::Rtl) lays it out right to left. Its descendants inherit it unless they set their own.
  • fn align_self(self, a: Align) -> Self — This child's alignment on the container's cross axis (grid/overlay: both axes).
  • fn place(self, horizontal: Align, vertical: Align) -> Self — This child's horizontal and vertical placement in grid cells / overlays.
  • fn at(self, col: usize, row: usize) -> Self — Grid: explicit cell (column, row).
  • fn span(self, cols: usize, rows: usize) -> Self — Grid: column and row span.
  • fn area(self, name: &str) -> Self — Grid: the named area this child sits in (see [Node::areas]).
  • fn maximize_tracks(self) -> Self — Grid: the named-area template, one string per row ("head head"). A . leaves the cell empty. The rows must all have the same number of Grid: let minmax tracks absorb the free space up to their maximum (see the foundation docs).
  • ...and 25 more

Trait implementations: Clone, Debug

structaster_blueprint::layout::Placed

pub struct Placed { /* see fields */ }

A solved node in absolute coordinates (root origin = viewport origin).

Public fields

fieldtype
idOption<String>
tagTag
rectRect
dirDirectionThe direction of this node (its own, or the one it inherits).
baselinef64Absolute y of the first baseline.
clipOption<Rect>Visible region inherited from enclosing scroll containers.
overflow[f64; 2]How far children extend past the content box (main/cross as x/y).
scrollOption<ScrollInfo>
textOption<(String, f64, String, text_measure::TextMetrics)>
linesVec<TextLine>Text nodes: the broken lines in absolute coordinates (one entry for single-line text). text's metrics carry the widest line width.
richOption<Box<Vec<TextPiece>>>Rich text nodes: the face-runs of every line, in absolute coordinates (one entry per line and run). None for a plain text.
childrenVec<Placed>

Methods

  • fn find(&self, id: &str) -> Option<&Placed>
  • fn walk<'a>(&self, f: &mut impl FnMut(&'a Placed)) — Depth-first, parents before children, in tree order.

Trait implementations: Clone, Debug, PartialEq, StructuralPartialEq

structaster_blueprint::layout::Rect

pub struct Rect { /* see fields */ }

Public fields

fieldtype
xf64
yf64
wf64
hf64

Methods

  • fn right(self) -> f64
  • fn bottom(self) -> f64
  • fn to_logical(self) -> Result<aster_ui::LogicalRect, aster_ui::Error>
  • fn intersect(self, o: Rect) -> Rect

Trait implementations: Clone, Copy, Debug, Default, PartialEq, StructuralPartialEq

structaster_blueprint::layout::ScrollInfo

pub struct ScrollInfo { /* see fields */ }

Public fields

fieldtype
offset[f64; 2]Applied (clamped) offset.
max_offset[f64; 2]Largest useful offset per axis (content - viewport, at least 0).
content[f64; 2]Content size.
view[f64; 2]Viewport size (the visible part of the content at an offset).
rtlboolThe container sits in a right-to-left subtree: the horizontal offset is measured from the right edge (0 shows the right end of the content, a larger offset reveals the left).

Trait implementations: Clone, Copy, Debug, PartialEq, StructuralPartialEq

structaster_blueprint::layout::Solved

pub struct Solved { /* see fields */ }

Public fields

fieldtype
rootPlaced

Methods

  • fn get(&self, id: &str) -> Option<&Placed>
  • fn rect(&self, id: &str) -> Option<Rect>
  • fn params(&self, prefix: &str) -> Result<Vec<(Symbol, Literal)>, LayoutError> — LogicalLength graph parameters prefix.id.x|y|w|h for every node with an id (tree order), so graph nodes consume solved geometry.

Trait implementations: Clone, Debug, PartialEq, StructuralPartialEq

structaster_blueprint::layout::Span

pub struct Span { /* see fields */ }

One inline run of a rich paragraph.

Public fields

fieldtype
textStringThe text of the run.
fontStringThe face of the run (the node's own face when it is empty).
sizef64The size of the run (the node's own size when it is zero).
colorOption<[u8; 4]>The colour of the run (the node's own colour when it is none).
dirOption<layout::Direction>The run is a directional isolate of this direction (None: it reads in the paragraph's flow).
decoDecoThe lines and background drawn with the run.

Methods

  • fn new(text: impl Into<String>) -> Span — A run of text in the node's own face, size and colour.
  • fn deco(self, deco: Deco) -> Span — Draw the run underlined, struck through or on a background.
  • fn dir(self, dir: Direction) -> Span — Make the run a directional isolate (UAX #9 LRI / RLI): it is resolved in dir on its own, as one neutral object of the paragraph around it, so a Hebrew name in an English sentence (or the other way round) does not pull the punctuation next to it into its direction.
  • fn font(self, f: impl Into<String>) -> Span — The face of the run (the node's own face when it is empty; "bold" is the bold face of the UI theme).
  • fn bold(self) -> Span — The bold face of the run.
  • fn size(self, s: f64) -> Span — The size of the run (px).
  • fn color(self, c: [u8; 4]) -> Span — The colour of the run (sRGB, straight alpha).

Trait implementations: Clone, Debug, PartialEq, StructuralPartialEq

structaster_blueprint::layout::TextLine

pub struct TextLine { /* see fields */ }

One laid-out line of a text node.

Public fields

fieldtype
textString
xf64Left edge of the glyph box (absolute).
yf64Top of the glyph box (absolute); its height is the font height.
wf64Measured width.
baselinef64Absolute baseline y.
dirDirectionThe base direction of the line's \n paragraph (the first strong character decides).

Trait implementations: Clone, Debug, PartialEq, StructuralPartialEq

structaster_blueprint::layout::TextPiece

pub struct TextPiece { /* see fields */ }

One drawn piece of a rich text line: a run of text in one face, size and colour.

Public fields

fieldtype
textStringThe text of the piece.
fontStringThe face of the piece.
sizef64The size of the piece.
colorOption<[u8; 4]>The colour of the piece (the element's own colour when it is none).
levelu8The bidi level of the piece: odd is shaped right to left ([crate::bidi]).
xf64Left edge of the glyph box (absolute).
yf64Top of the glyph box (absolute); its height is the face's height.
wf64Measured width.
hf64The height of the face (ascent + descent + gap).
baselinef64Absolute baseline y (the runs of a line share it).
line[f64; 2]Absolute top and height of the whole line the piece sits on (a background fills it).
decorich_text::DecoThe lines and background drawn with the piece.

Trait implementations: Clone, Debug, PartialEq, StructuralPartialEq

structaster_blueprint::layout::WrapOpts

pub struct WrapOpts { /* see fields */ }

The wrap options of one text node.

Public fields

fieldtype
rulesWrapRulesThe break opportunities the breaker may use.
modeWrapModeHow the breaker places the breaks.

Methods

  • const fn new(rules: WrapRules, mode: WrapMode) -> Self — The options of one mode and one rule set.

Trait implementations: Clone, Copy, Debug, Default, Eq, PartialEq, StructuralPartialEq

Enums

enumaster_blueprint::layout::Align

pub enum Align { Start, Center, End, Stretch, Baseline }

Variants

  • Start
  • Center
  • End
  • Stretch
  • Baseline

Trait implementations: Clone, Copy, Debug, Eq, PartialEq, StructuralPartialEq

enumaster_blueprint::layout::Direction

pub enum Direction { Ltr, Rtl }

The reading direction of a subtree: left-to-right (the default) or right-to-left. A node inherits the direction of its parent unless it sets its own (see [Node::dir]).

In a right-to-left subtree the children of a container are placed from the right edge to the left, Start is the right edge and End the left one, the columns of a grid run right to left, a horizontal scroll starts at the right and the text of a line is aligned to the right when it is Start.

Methods

  • fn is_rtl(self) -> bool — Whether this is right-to-left.
  • fn flipped(self) -> Self — The other direction.

Variants

  • Ltr
  • Rtl

Trait implementations: Clone, Copy, Debug, Default, Eq, PartialEq, StructuralPartialEq

enumaster_blueprint::layout::Justify

pub enum Justify { Start, Center, End, SpaceBetween, SpaceAround, SpaceEvenly }

Variants

  • Start
  • Center
  • End
  • SpaceBetween
  • SpaceAround
  • SpaceEvenly

Trait implementations: Clone, Copy, Debug, Eq, PartialEq, StructuralPartialEq

enumaster_blueprint::layout::LayoutError

pub enum LayoutError { Invalid, MinExceedsMax, DuplicateId, Structure, TooLarge, NoTextMeasurer, NativeFontsRequired, UnknownFont, Text }

Variants

  • Invalid — A non-finite, negative or otherwise unusable value.
  • MinExceedsMax — min > max on axis 0 (width) or 1 (height).
  • DuplicateId
  • Structure — Structural error (grid cell out of range / occupied, scroll without exactly one child, empty grid columns...).
  • TooLarge
  • NoTextMeasurer — A text node was solved with no measurer (see [NoText]).
  • NativeFontsRequired — Real text measurement requires the native-fonts feature.
  • UnknownFont
  • Text — An aster-ui text error, rendered with Debug.

Trait implementations: Clone, Debug, Display, Error, From<LayoutError>, PartialEq, StructuralPartialEq

enumaster_blueprint::layout::Len

pub enum Len { Px, Dp, Pct, Vw, Vh, Vmin, Vmax, Em, Rem, Fr, Clamp, Min, Max }

A length with a unit, resolved at layout time against a [LenCtx] and the parent's content box (percentages). The f64 setters of [Node] mean [Len::Px].

Methods

  • fn clamp(min: Len, preferred: Len, max: Len) -> Len — CSS clamp(min, preferred, max): the preferred length held between the two bounds. Resolved at layout time, so the bounds may use any unit.
  • fn min(a: Len, b: Len) -> Len — The smaller of two lengths (resolved at layout time).
  • fn max(a: Len, b: Len) -> Len — The larger of two lengths (resolved at layout time).
  • fn is_px(&self) -> bool — Whether the length is plain logical pixels.
  • fn has_fr(&self) -> bool — Whether the length holds an fr (valid only in a grid track).
  • fn has_pct(&self) -> bool — Whether the length depends on the percentage basis.
  • fn resolve_opt(&self, basis: Option<f64>, ctx: &LenCtx) -> Option<f64> — The length in logical px, or None when it cannot be known: a percentage of an indefinite basis, or a viewport unit while the viewport is unknown (vw/vh = 0). basis is the percentage basis: the parent's content box on the axis the length is used on. A clamp whose bounds cross lets the minimum win, like CSS.
  • fn resolve(&self, basis: f64, ctx: &LenCtx) -> f64 — The length in logical px against a definite basis; an unknown length (see [Len::resolve_opt]) is 0.

Variants

  • Px — Logical pixels.
  • Dp — Device-independent pixels: 1 dp is 1 logical px in the logical solver.
  • Pct — Percent of the parent's content box on that axis.
  • Vw — Percent of the viewport width.
  • Vh — Percent of the viewport height.
  • Vmin — Percent of the smaller viewport side.
  • Vmax — Percent of the larger viewport side.
  • Em — Multiples of the context's em.
  • Rem — Multiples of the context's rem.
  • Fr — A share of the free space (grid tracks only).
  • Clamp — clamp(min, preferred, max).
  • Min — The smaller of two lengths.
  • Max — The larger of two lengths.

Trait implementations: Clone, Debug, From<f64>, PartialEq, StructuralPartialEq

enumaster_blueprint::layout::Repeat

pub enum Repeat { AutoFill, AutoFit }

How a repeat() fills its tracks: AutoFill keeps the empty ones, AutoFit collapses them and lets the rest grow into the free space.

Variants

  • AutoFill
  • AutoFit

Trait implementations: Clone, Copy, Debug, Eq, PartialEq, StructuralPartialEq

enumaster_blueprint::layout::ScrollAxis

pub enum ScrollAxis { Vertical, Horizontal, Both }

Variants

  • Vertical
  • Horizontal
  • Both

Trait implementations: Clone, Copy, Debug, Eq, PartialEq, StructuralPartialEq

enumaster_blueprint::layout::Tag

pub enum Tag { Box, Text, Row, Column, Wrap, Grid, Overlay, Scroll, Container, Safe }

Tag of a solved node.

Variants

  • Box
  • Text
  • Row
  • Column
  • Wrap
  • Grid
  • Overlay
  • Scroll
  • Container — A container query (its child is built from its own size).
  • Safe — A safe-area wrapper.

Trait implementations: Clone, Copy, Debug, Eq, PartialEq, StructuralPartialEq

enumaster_blueprint::layout::TextAlign

pub enum TextAlign { Start, Center, End }

Horizontal alignment of each line of a multi-line text within its box.

Variants

  • Start
  • Center
  • End

Trait implementations: Clone, Copy, Debug, Default, Eq, PartialEq, StructuralPartialEq

enumaster_blueprint::layout::Track

pub enum Track { Px, Fr, Auto, Minmax, Repeat }

A grid track: a fixed size, a share of the free space, a content size, a minmax(min, max) bound or a repeat(auto-fill | auto-fit, track) run.

Variants

  • Px
  • Fr
  • Auto
  • Minmax — minmax(min, max): at least min, at most max. A Fr max shares the free space; any other max is a hard limit.
  • Repeat — repeat(auto-fill | auto-fit, track): the track repeats as often as fits.

Trait implementations: Clone, Debug, PartialEq, StructuralPartialEq

enumaster_blueprint::layout::WrapMode

pub enum WrapMode { Greedy, Balance, Pretty }

How the line breaker places the breaks.

Variants

  • Greedy — Greedy: every line takes as much as fits (the default).
  • Balance — Balance: keep the line count and narrow the lines to the narrowest width that still fits them (for headings and titles).
  • Pretty — Pretty: keep the line count and re-break the tail so the last line is not a short orphan.

Trait implementations: Clone, Copy, Debug, Default, Eq, PartialEq, StructuralPartialEq

enumaster_blueprint::layout::WrapRules

pub enum WrapRules { Ascii, Unicode }

Which break opportunities the line breaker may use.

Variants

  • Ascii — ASCII spaces only: the classic greedy wrap (the default).
  • Unicode — A pragmatic subset of UAX #14: after hyphens, en and em dashes, after the slashes of a URL or a path, at every CJK boundary (never before a closing punctuation), at a zero width space (U+200B) and at a soft hyphen (U+00AD, which shows a hyphen when the line breaks there). A no-break space (U+00A0) and a word joiner (U+2060) are non-breaks.

Trait implementations: Clone, Copy, Debug, Default, Eq, PartialEq, StructuralPartialEq

Functions

fnaster_blueprint::layout::aspect_box

pub fn aspect_box(ratio: f64) -> Node

A leaf with no size and a width / height ratio: the free axis follows the other one.

fnaster_blueprint::layout::auto_box

pub fn auto_box() -> Node

A leaf with no size: it takes the size its parent gives it (a grid cell, a stretched flex item).

fnaster_blueprint::layout::bx

pub fn bx(w: f64, h: f64) -> Node

A leaf with an exact size.

fnaster_blueprint::layout::col

pub fn col() -> Node

Vertical stack.

fnaster_blueprint::layout::container

pub fn container(f: impl Fn(f64, f64) -> Node + 'static) -> Node

A container query: the child is built from the container's own resolved size (its content box, in logical px). The container needs a definite size on the axes it queries; an indefinite axis queries 0.

fnaster_blueprint::layout::grid

pub fn grid(cols: impl IntoIterator<Item = Track>, rows: impl IntoIterator<Item = Track>) -> Node

Grid with column and row tracks (rows are extended with Auto as needed).

fnaster_blueprint::layout::grid_cols

pub fn grid_cols(n: usize) -> Node

n equal 1fr columns.

fnaster_blueprint::layout::overlay

pub fn overlay() -> Node

Children stacked on top of each other in the same box (later = on top). Children with an Auto size fill the box by default (Align::Stretch); use .place(h, v) / .align_self(..) on a child, or .align(..) on the overlay, to position them instead.

fnaster_blueprint::layout::paragraph

pub fn paragraph(font: &str, size: f64, text: &str) -> Node

A word-wrapping text leaf: breaks at spaces to the width it is given (explicit \n always breaks; over-long words break between characters). Same as text(..).wrapped(). Its height follows its solved width.

fnaster_blueprint::layout::rich

pub fn rich(font: &str, size: f64, spans: impl IntoIterator<Item = Span>) -> Node

A rich text leaf: the inline runs of one paragraph, laid out as one text (the lines break across the runs, the runs of a line share one baseline). The runs that do not name their own face and size take font and size.

fnaster_blueprint::layout::row

pub fn row() -> Node

Horizontal stack.

fnaster_blueprint::layout::safe_area

pub fn safe_area(child: Node) -> Node

A wrapper that keeps its child inside the safe area (the context's insets).

fnaster_blueprint::layout::scroll

pub fn scroll(child: Node) -> Node

Clip + offset container around one child.

fnaster_blueprint::layout::spacer

pub fn spacer() -> Node

An empty flexible gap (grow = 1).

fnaster_blueprint::layout::span

pub fn span(text: impl Into<String>) -> Span

A run of text in the node's own face, size and colour.

fnaster_blueprint::layout::text

pub fn text(font: &str, size: f64, text: &str) -> Node

A single-line text leaf, measured by the layout pass.

fnaster_blueprint::layout::wrap

pub fn wrap() -> Node

Horizontal stack that wraps onto new lines.

fnaster_blueprint::layout::wrap_col

pub fn wrap_col() -> Node

Vertical stack that wraps onto new columns (needs a definite height).

Constants

constaster_blueprint::layout::MAX_COORD

pub const MAX_COORD: f64

constaster_blueprint::layout::MAX_DEPTH

pub const MAX_DEPTH: usize

constaster_blueprint::layout::MAX_NODES

pub const MAX_NODES: usize

Largest node count / depth / coordinate magnitude a layout accepts.