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 strHorizontal border character.
mid_left: &'static strLeft border character for section separators and middle rules.
mid_right: &'static strRight border character for section separators and middle rules.
mid_joint: &'static strJoint character for interior separators.
Implementations§
Source§impl SectionStyle
impl SectionStyle
Sourcepub fn unicode() -> Self
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}Sourcepub fn from_table_style(table_style: TableStyle) -> Self
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
impl Clone for SectionStyle
Source§fn clone(&self) -> SectionStyle
fn clone(&self) -> SectionStyle
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SectionStyle
impl Debug for SectionStyle
Source§impl PartialEq for SectionStyle
impl PartialEq for SectionStyle
impl Copy for SectionStyle
impl Eq for SectionStyle
impl StructuralPartialEq for SectionStyle
Auto Trait Implementations§
impl Freeze for SectionStyle
impl RefUnwindSafe for SectionStyle
impl Send for SectionStyle
impl Sync for SectionStyle
impl Unpin for SectionStyle
impl UnsafeUnpin for SectionStyle
impl UnwindSafe for SectionStyle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more