Skip to main content

SectionStyle

Struct SectionStyle 

Source
pub struct SectionStyle {
    pub horiz: &'static str,
    pub mid_left: &'static str,
    pub mid_right: &'static str,
    pub mid_joint: &'static str,
}
Expand description

Characters used to overwrite section and separator styles.

Fields§

§horiz: &'static str

Horizontal border character.

§mid_left: &'static str

Left border character for section separators and middle rules.

§mid_right: &'static str

Right border character for section separators and middle rules.

§mid_joint: &'static str

Joint character for interior separators.

Implementations§

Source§

impl SectionStyle

Source

pub fn unicode() -> Self

Return the default Unicode border style for sections and separators.

Examples found in repository?
examples/styled.rs (line 18)
3fn main() {
4    let mut table = Table::with_columns(vec![
5        Column::new("Name").bright_cyan().bold().width(0.3),
6        Column::new("Role").width(0.4).truncate(Trunc::Middle),
7        Column::new("Status").bright_yellow().bold().width(0.3),
8    ])
9    .with_section_style(SectionStyle {
10        horiz: "═",
11        mid_left: "╞",
12        mid_right: "╡",
13        mid_joint: "╪",
14    })
15    .with_separator_style(SectionStyle {
16        horiz: "╌",
17        mid_joint: "│",
18        ..SectionStyle::unicode()
19    });
20
21    table.add_section("Team").align(Align::Center);
22    table.add_row(vec![
23        Cell::new("Ada Lovelace"),
24        Cell::new("Principal Engineer"),
25        Cell::new("Active").bright_green(),
26    ]);
27
28    table.add_separator();
29    table.add_row(vec![
30        Cell::new("Bob"),
31        Cell::new("Support"),
32        Cell::new("Away"),
33    ]);
34
35    println!("{}", table);
36}
Source

pub fn from_table_style(table_style: TableStyle) -> Self

Convert a TableStyle into a SectionStyle by taking the relevant fields

Trait Implementations§

Source§

impl Clone for SectionStyle

Source§

fn clone(&self) -> SectionStyle

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for SectionStyle

Source§

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

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

impl PartialEq for SectionStyle

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for SectionStyle

Source§

impl Eq for SectionStyle

Source§

impl StructuralPartialEq for SectionStyle

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