pub struct ColumnRoom<'a> {
pub heading: &'a str,
pub width: Width,
pub priority: Priority,
pub kind: ColumnKind,
pub min: Option<u16>,
pub caret: bool,
}Expand description
What one column asks of the sizer: the room it needs and what it is worth.
A layout record and nothing else. It holds the heading only because the heading is what a column must at least fit, and it says whether a sort caret sits beside it for the same reason; what the column holds, how it is ordered and what pressing it does are its describer’s. Every renderer sizes a table from these, so the floor and the cutoff are one rule on every host whatever type the columns were described in.
Fields§
§heading: &'a strThe heading the column must at least fit.
width: WidthHow much room it asks for.
priority: PriorityWhat it is worth when room runs out.
kind: ColumnKindWhat it holds, which carries a floor of its own.
min: Option<u16>The narrowest it may be before it drops, in ch, when declared.
wiki frontend-unification: collapse points derive from declared
minimums only, so every host narrows at the same declared width rather
than at its own breakpoints. ch because every host has a direct
answer for it: a terminal cell is one, an immediate-mode painter
measures one off its face, and a webview draws one as nine sixteenths
of the base, a figure at a table’s text size with room to spare. Not
the CSS ch itself, because a container condition resolves
font-relative units against a different font than the cell’s, and the
column would hide at one width and be sized at another.
None derives it from the kind and the heading, which is what most
columns want. Read it through floor, never directly:
that is where the derivation, the rounding and the ceiling live, and a
host reading this field would narrow somewhere the other two do not.
caret: boolWhether a sort caret sits beside the heading: the column is sortable, or is the one the table is ordered by.
Implementations§
Source§impl<'a> ColumnRoom<'a>
impl<'a> ColumnRoom<'a>
Sourcepub const fn new(heading: &'a str) -> Self
pub const fn new(heading: &'a str) -> Self
A text column under heading that fills and is essential, the defaults
a column takes when it says nothing.
Sourcepub const fn floor(&self) -> u16
pub const fn floor(&self) -> u16
The narrowest this column may be before it drops, in ch.
What every host narrows by: a column is kept at a cutoff only while the
floors of every column kept there fit. The declared min,
or else the widest of the kind’s floor, the
heading with two for its capitals and two more for a caret, and sixteen
for a Width::Fill column. Rounded up to an even count and held under
MIN_CEILING, so a webview can carry the whole range as a fixed ladder
of classes and the other two hosts round the same way.
Sourcepub const fn kept_at(&self, cutoff: Priority) -> bool
pub const fn kept_at(&self, cutoff: Priority) -> bool
Whether this column is kept at cutoff.
A renderer narrows by raising the cutoff, and never by counting positions.
Sourcepub fn budget(rooms: &[Self], cutoff: Priority) -> Budget
pub fn budget(rooms: &[Self], cutoff: Priority) -> Budget
What the columns kept at cutoff ask for.
Sourcepub fn cutoff_for(rooms: &[Self], fits: impl Fn(Budget) -> bool) -> Priority
pub fn cutoff_for(rooms: &[Self], fits: impl Fn(Budget) -> bool) -> Priority
The weakest cutoff whose kept columns fits accepts.
Raised through Priority::RAISING until the columns fit, and never
past the strongest priority any column declares: the essential columns
are what makes a row identify itself, so a window too narrow for them
gets them squeezed rather than dropped. A table with no essential column
therefore never rises to Priority::Essential, where the budget would
keep no column at all. Nothing here counts positions, so which column
drops is a property of the column.