pub struct Table {Show 21 fields
pub title: Option<String>,
pub caption: Option<String>,
pub box_style: BoxStyle,
pub show_header: bool,
pub show_footer: bool,
pub show_edge: bool,
pub show_lines: bool,
pub padding: (usize, usize, usize, usize),
pub collapse_padding: bool,
pub style: Style,
pub border_style: Style,
pub title_style: Style,
pub caption_style: Style,
pub title_justify: AlignMethod,
pub caption_justify: AlignMethod,
pub highlight: bool,
pub width: Option<usize>,
pub row_styles: Vec<Style>,
pub leading: usize,
pub rowspans: Vec<usize>,
pub section_rows: HashSet<usize>,
/* private fields */
}Expand description
A renderable for tabular data.
Fields§
§title: Option<String>Title above the table.
caption: Option<String>Caption below the table.
box_style: BoxStyleBox style.
show_header: boolShow the header row.
Show the footer row.
show_edge: boolShow outer edge border.
show_lines: boolShow lines between every row.
padding: (usize, usize, usize, usize)Padding per cell (top, right, bottom, left).
collapse_padding: boolCollapse padding between rows.
style: StyleDefault style for the table.
border_style: StyleBorder style.
title_style: StyleTitle style.
caption_style: StyleCaption style.
title_justify: AlignMethodTitle justification.
caption_justify: AlignMethodCaption justification.
highlight: boolIf true, highlight cell strings.
width: Option<usize>Optional fixed width.
row_styles: Vec<Style>Row styles (alternating).
leading: usizeNumber of blank lines between rows.
rowspans: Vec<usize>Active rowspan counts per column (tracked during rendering).
section_rows: HashSet<usize>Row indices that have a section separator before them.
Implementations§
Source§impl Table
impl Table
Sourcepub fn add_column(&mut self, column: Column)
pub fn add_column(&mut self, column: Column)
Add a column definition to the table.
Columns must be added before rows are populated.
§Examples
use rusty_rich::{Table, Column};
let mut table = Table::new();
table.add_column(Column::new("Name"));
table.add_column(Column::new("Age"));Sourcepub fn add_row_str(&mut self, row: Vec<String>)
pub fn add_row_str(&mut self, row: Vec<String>)
Sourcepub fn border_style(self, s: Style) -> Self
pub fn border_style(self, s: Style) -> Self
Builder: set border style.
Sourcepub fn hide_header(self) -> Self
pub fn hide_header(self) -> Self
Builder: hide the header.
Sourcepub fn show_lines(self) -> Self
pub fn show_lines(self) -> Self
Builder: show lines.
Sourcepub fn grid() -> Self
pub fn grid() -> Self
Create a grid table (no outer border, no header, no footer).
Equivalent to Table.grid().
Sourcepub fn add_section(&mut self)
pub fn add_section(&mut self)
Add a section separator before the next row. The next row added will have a horizontal rule above it.
Trait Implementations§
Source§impl Renderable for Table
impl Renderable for Table
Source§fn render(&self, options: &ConsoleOptions) -> RenderResult
fn render(&self, options: &ConsoleOptions) -> RenderResult
RenderResult using the provided options. Read moreSource§fn measure(&self, _options: &ConsoleOptions) -> Option<Measurement>
fn measure(&self, _options: &ConsoleOptions) -> Option<Measurement>
__rich_measure__).
Override to provide min/max width constraints for layout.