Skip to main content

TableInk

Struct TableInk 

Source
#[non_exhaustive]
pub struct TableInk { pub header: Style, pub sorted: Style, pub sortable: Style, pub value: Style, pub tokens: Style, pub actions: Style, pub link: Style, pub selected: Style, pub ground: Style, pub stripe: Style, pub style: TableStyle, }
Expand description

A Palette and a TableStyle, resolved into the styles a table draws with.

The table model (wiki table-model): rows on the raised ground with a stripe, the heading a sunken strip in bold secondary ink with the ordered column brought up to primary, each cell part in the ink CellPart::intent names, and selection carried by the background alone.

Where the palette has no colour for a role the table says it with a modifier: a bold heading, a reversed cursor row. Where the terminal cannot tell the strip from the ground, the heading is underlined as well, since the separation is what the strip is for.

Selection carries no foreground on purpose. A row can be red for a failed upload or green for a published item, and repainting its text on selection loses that on exactly the row the user is looking at.

Public for a caller assembling its own Table, which takes stripe and selected from here.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§header: Style

The heading row.

§sorted: Style

The heading of the column the table is ordered by.

§sortable: Style

The heading of a column that offers to reorder and is not doing it now.

The middle of three tones (wiki three-tone-convention): it answers a press, so it is neither the emphasised thing nor the inert one.

§value: Style

A cell that is text.

§tokens: Style

A cell holding badges or chips. They carry their own tone, so this is what shows through the gaps rather than what paints them.

§actions: Style

A cell holding controls. They carry their own ink, so this is what an unstyled run beside them takes.

§link: Style

A cell whose value is itself a link: its row’s title, in the ink the values beside it take and with no underline, since the row is what activates.

§selected: Style

The row under the cursor, for a caller rendering with a TableState.

§ground: Style

What a row sits on.

§stripe: Style

What every second row sits on, counting from the first body row.

Not drawn in a table holding a ColumnKind::Code column, which is read as source: one row per line, where a stripe breaks the reading.

§style: TableStyle

The metrics and marks.

Implementations§

Source§

impl TableInk

Source

pub fn new(palette: &Palette, style: &TableStyle) -> Self

Resolve palette’s tones under style’s metrics.

Source

pub fn for_part(&self, part: Option<CellPart>) -> Style

The style a cell of this part takes.

CellPart is #[non_exhaustive], and a member added upstream lands on value: a part this renderer has not learned draws as text, which is a cell rendering plainly rather than a build that stops.

Trait Implementations§

Source§

impl Clone for TableInk

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

Source§

impl Debug for TableInk

Source§

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

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

impl Eq for TableInk

Source§

impl PartialEq for TableInk

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 StructuralPartialEq for TableInk

Auto Trait Implementations§

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.