#[non_exhaustive]pub enum Flow {
Tight,
Relaxed,
}Expand description
The parts of a list row.
Four to begin with, taken from Balanced Breakfast, which was the only
consumer that had all of them (row-primary, row-secondary, row-meta,
row-actions). audiofiles has two and no slot structure at all, so it gains
meta and actions as real work rather than a rename; goingson moves off
task-row / task-cell.
Tokens joined at 0.9.0, and #[non_exhaustive] with it.
See the crate header for why the two arrived together.
§Meta against Tokens
The line is whether the thing has its own standing. Meta is one short
trailing fact about the row, written as text: a count, a size, a date.
Tokens is a set of small labelled things, each of which can be toned and
can answer a click. “3 files” is meta. A status badge that is amber, and a
tag you can click to filter by, are tokens.
Keeping them apart is what a single widened slot would have foreclosed. A renderer can right-align one string and cannot usefully do the same to a strip of chips, and a fact that is not clickable should not be drawn as though it were. How much vertical room a part’s text may take.
A row is an inline run and every part in it is a leaf, so a part’s text has
always been drawn on one line and no description could say otherwise. Two
apps say otherwise in their own stylesheets, both to the same number and
both with a comment explaining it: Balanced Breakfast clamps a feed row’s
title to two lines (.row--article .row-primary, whose comment reads
“overrides .row-primary’s single flex line”), and goingson clamps a
problem’s body to two (“two lines is enough to recognize one, and the full
text is in the task once promoted”).
Two named tiers rather than a line count, and the count is what the measured demand argues against. Both sites want exactly one tier past the default, and a number invites a row whose primary is a paragraph, which is a block and has no business in a run. A third tier is a decision, made here, rather than something a call site can reach for.
What a renderer owes it: Tight is what a run already does and needs no
answer. Relaxed is at most two lines and then truncation, however that
renderer truncates – a webview clamps, a terminal wraps into two rows of
cells, an immediate-mode renderer caps the galley. A renderer that cannot
give two lines may draw one; what it may not do is grow without bound,
because the run is a line and the row’s neighbours are relying on that.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Tight
One line. What every part did before this type existed.
Relaxed
Up to two lines, then truncated.
Implementations§
Source§impl Flow
impl Flow
Sourcepub const fn lines(self) -> u8
pub const fn lines(self) -> u8
How many lines the part may take.
A number here rather than in the enum, because a renderer needs one and a call site does not. That asymmetry is the whole argument for the tiers: the description says how much room the thing deserves and this says what that costs, so a third tier changes one line rather than every consumer’s arithmetic.