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, in ch, when declared. None derives it.
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 survives at the given cutoff.
A renderer narrows by raising the cutoff, and never by counting
positions.
Whether this column is kept at cutoff.
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. See
cutoff_for for the rule.