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