Skip to main content

TableStyle

Struct TableStyle 

Source
pub struct TableStyle {
    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 column_spacing: u16,
    pub ascending: &'static str,
    pub descending: &'static str,
}
Expand description

The tones and metrics a table draws with.

Apart from [Palette] rather than added to it, and the split is the one makeover-immediate draws between its palette and its FieldStyle: [Palette] answers what a surface is, which is what frame needs, and a table is the first thing in this crate that draws text. Folding text tones into [Palette] would make every consumer that only paints a bevel supply six colours it never uses.

from_theme is the answer for anyone with a loaded theme, and is what a consumer should reach for first.

Fields§

§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. A heading that took header here would be indistinguishable from a column that cannot be reordered at all, which is the state this separates it from.

§value: Style

A cell that is text.

§tokens: Style

A cell holding badges or chips. They carry their own tone, so this is what sits under one rather than what paints it.

§actions: Style

A cell holding controls.

§link: Style

A cell whose value is itself a link.

§selected: Style

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

§column_spacing: u16

Cells between columns. Counted when deciding what fits, so a table that narrows and a table that draws agree about the room available.

§ascending: &'static str

The caret drawn after the heading of an ascending column.

Defaults to Sort::glyph, which is where the spelling lives now: three renderers holding the same literal agreed by coincidence. Still a knob, because a terminal is the one host that may not be able to draw it — a font without the geometric-shapes block leaves a box, and "^" is a better caret than a tofu.

Bare, with no leading space: the gap is [heading]’s, written once for all three states rather than baked into two strings and forgotten in the third.

§descending: &'static str

The caret drawn after the heading of a descending column.

Implementations§

Source§

impl TableStyle

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. Grep this when adopting a new makeover-layout.

Trait Implementations§

Source§

impl Clone for TableStyle

Source§

fn clone(&self) -> TableStyle

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 TableStyle

Source§

impl Debug for TableStyle

Source§

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

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

impl Default for TableStyle

Source§

fn default() -> Self

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

impl Eq for TableStyle

Source§

impl PartialEq for TableStyle

Source§

fn eq(&self, other: &TableStyle) -> 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 TableStyle

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 = Infallible

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.