pub struct Column<'a> {
pub name: &'a str,
pub width: Width,
pub priority: Priority,
pub kind: ColumnKind,
pub min: Option<u16>,
pub sortable: bool,
pub sorted: Option<Sort>,
}Expand description
One column of a table.
Described once. The grid track, the cell order and the drop behaviour are all derived from this, rather than being three hand-written encodings that must agree and are never checked against each other.
Fields§
§name: &'a strThe heading, and the name the cell is addressed by.
width: WidthHow much room it asks for.
priority: PriorityWhat it is worth when room runs out.
kind: ColumnKindWhat the column holds, which is what carries its look.
min: Option<u16>The narrowest the column may be before it drops, in ch.
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.
sortable: boolWhether the user can reorder the table by this column.
What reordering calls is not here — that is an address, and this crate names none — so a host pairs this with the route the way it pairs a row’s parts with the row’s activation. This says the affordance exists, which is what a renderer needs to draw a header a user can press rather than a heading they cannot.
sorted: Option<Sort>Which way the table is ordered by this column, if it is.
None on every column but the one in force. A renderer draws the caret
from this and a webview sets aria-sort, which is why it is per column
rather than a single fact on the table: the host idiom is a property of
the header cell.
Independent of sortable rather than implied by it,
because both combinations mean something. A column sorted and not
sortable is a list ordered by a key the user cannot change, which is a
real thing to describe and a caret worth drawing.
Implementations§
Source§impl<'a> Column<'a>
impl<'a> Column<'a>
Sourcepub const fn new(name: &'a str) -> Self
pub const fn new(name: &'a str) -> Self
A column that absorbs slack and drops after the optional ones.
Sourcepub const fn min(self, ch: u16) -> Self
pub const fn min(self, ch: u16) -> Self
The same column, declaring the narrowest it may be before it drops.
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.