Skip to main content

SectionBuilder

Struct SectionBuilder 

Source
pub struct SectionBuilder<'a> { /* private fields */ }
Expand description

Builder returned by Table::add_section and Table::add_separator.

Implementations§

Source§

impl<'a> SectionBuilder<'a>

Source

pub fn align(self, align: Align) -> Self

Set the alignment for the section label.

Examples found in repository?
examples/styled.rs (line 21)
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 style(self, style: SectionStyle) -> Self

Set the border style used when rendering this section or separator.

Auto Trait Implementations§

§

impl<'a> Freeze for SectionBuilder<'a>

§

impl<'a> RefUnwindSafe for SectionBuilder<'a>

§

impl<'a> Send for SectionBuilder<'a>

§

impl<'a> Sync for SectionBuilder<'a>

§

impl<'a> Unpin for SectionBuilder<'a>

§

impl<'a> UnsafeUnpin for SectionBuilder<'a>

§

impl<'a> !UnwindSafe for SectionBuilder<'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> 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, 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.