Skip to main content

Flow

Enum Flow 

Source
#[non_exhaustive]
pub enum Flow { Tight, Relaxed, }
Expand description

The parts of a list row.

#[non_exhaustive]: a renderer carries a wildcard arm, so a new part is not a lockstep event across three renderers.

§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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Tight

One line. What every part did before this type existed.

§

Relaxed

Up to two lines, then truncated.

Implementations§

Source§

impl Flow

Source

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.

Trait Implementations§

Source§

impl Clone for Flow

Source§

fn clone(&self) -> Flow

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 Copy for Flow

Source§

impl Debug for Flow

Source§

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

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

impl Default for Flow

Source§

fn default() -> Flow

Returns the “default value” for a type. Read more
Source§

impl Eq for Flow

Source§

impl Hash for Flow

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 PartialEq for Flow

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Flow

Auto Trait Implementations§

§

impl Freeze for Flow

§

impl RefUnwindSafe for Flow

§

impl Send for Flow

§

impl Sync for Flow

§

impl Unpin for Flow

§

impl UnsafeUnpin for Flow

§

impl UnwindSafe for Flow

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, <T as TryFrom<U>>::Error>

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.