Skip to main content

ColumnRoom

Struct ColumnRoom 

Source
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 str

The heading the column must at least fit.

§width: Width

How much room it asks for.

§priority: Priority

What it is worth when room runs out.

§kind: ColumnKind

What 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: bool

Whether 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>

Source

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.

Source

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.

Source

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.

Source

pub fn budget(rooms: &[Self], cutoff: Priority) -> Budget

What the columns kept at cutoff ask for.

Source

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.

Trait Implementations§

Source§

impl<'a> Clone for ColumnRoom<'a>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for ColumnRoom<'a>

Source§

impl<'a> Debug for ColumnRoom<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> Eq for ColumnRoom<'a>

Source§

impl<'a> Hash for ColumnRoom<'a>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<'a> PartialEq for ColumnRoom<'a>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<'a> StructuralPartialEq for ColumnRoom<'a>

Auto Trait Implementations§

§

impl<'a> Forget for ColumnRoom<'a>

§

impl<'a> Freeze for ColumnRoom<'a>

§

impl<'a> Move for ColumnRoom<'a>

§

impl<'a> RefUnwindSafe for ColumnRoom<'a>

§

impl<'a> Send for ColumnRoom<'a>

§

impl<'a> Sync for ColumnRoom<'a>

§

impl<'a> Unpin for ColumnRoom<'a>

§

impl<'a> UnsafeUnpin for ColumnRoom<'a>

§

impl<'a> UnwindSafe for ColumnRoom<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.