Skip to main content

Crate frus_layout

Crate frus_layout 

Source
Expand description

frus-layout — frus’s layout engine.

It turns a tree of styled nodes into positioned rectangles, in absolute coordinates, ready for frus-gpu to draw.

The implementation rests on taffy for flexbox, but taffy is entirely hidden behind frus’s own API, so it can be replaced later without breaking anything public.

Structs§

Layout
A layout tree. T is user data attached to the nodes — a colour, say — handed back with each computed rectangle.
Overflowing
A box whose children do not fit inside it, and by how much.
Rect
An axis-aligned rectangle, in logical pixels.
Size
A 2D size (width × height).
Style
A layout node’s style.

Enums§

Align
How children are aligned on the cross axis.
AlignContent
How a wrapping container’s lines are distributed on the cross axis.
Dimension
The dimension of one axis, width or height.
FlexDirection
The main-axis direction of a flex container.
Justify
How children are distributed along the main axis.
Side
The edge a box’s content ran past.

Type Aliases§

MeasureFn
A constrained measurement for a leaf whose size depends on the space offered — wrapping text, custom-painted content. It receives the maximum width and height (None = unconstrained) and returns the content’s size. Taffy calls it during layout, including for intrinsic sizes (min-content gives a width of Some(0.0), max-content gives None). The lifetime is what lets a measurement borrow: a text’s closure owns everything it needs and is 'static, but a crate::Layout built for a widget tree can hold a closure that borrows the tree, which is how a box whose content is built from the space offered gets measured at all.
NodeId
An opaque identifier for a layout node.