Expand description
Tabular data with column definitions, colspan/rowspan, sections, and 17 border styles.
Table — tabular data with columns. Equivalent to Rich’s table.py.
§Overview
The Table renderable displays data in rows and columns with rich
styling. Each column is defined by a Column that specifies header,
footer, alignment, width constraints, and ratio. Cells can optionally
span multiple columns or rows via Cell::colspan and Cell::rowspan.
§Quick Example
use rusty_rich::{Table, Column};
let mut table = Table::new();
table.add_column(Column::new("Name"));
table.add_column(Column::new("Age"));
table.add_row_str("Alice", "30");
table.add_row_str("Bob", "25");§Colspan & Rowspan
use rusty_rich::{Table, Column, Cell};
let mut table = Table::new();
table.add_column(Column::new("A"));
table.add_column(Column::new("B"));
table.add_row(vec![Cell::new("spans both").colspan(2)]);§Box Styles
Tables support all 17 box styles from crate::box_drawing. The default
is BOX_HEAVY_HEAD. Change it with
Table::box_style.
§Sections
Call Table::add_section to insert a section divider between groups of
rows.