Expand description
The purpose of term-table is to make it easy for CLI apps to display data in a table format
§Example
Here is an example of how to create a simple table
use term_data_table::{ Table, Cell, TableStyle, Alignment, Row };
let table = Table::new()
.with_style(TableStyle::EXTENDED)
.with_row(Row::new().with_cell(
Cell::from("This is some centered text")
.with_alignment(Alignment::Center)
.with_col_span(2)
))
.with_row(Row::new().with_cell(
Cell::from("This is left aligned text")
).with_cell(
Cell::from("This is right aligned text")
.with_alignment(Alignment::Right)
))
.with_row(Row::new().with_cell(
Cell::from("This is left aligned text")
).with_cell(
Cell::from("This is right aligned text")
.with_alignment(Alignment::Right)
))
.with_row(Row::new().with_cell(
Cell::from("This is some really really really really really really really really really that is going to wrap to the next line")
.with_col_span(2)
));
println!("{}", table.fixed_width(80));
§This is the result
╔═════════════════════════════════════════════════════════════════════════════════╗ ║ This is some centered text ║ ╠════════════════════════════════════════╦════════════════════════════════════════╣ ║ This is left aligned text ║ This is right aligned text ║ ╠════════════════════════════════════════╬════════════════════════════════════════╣ ║ This is left aligned text ║ This is right aligned text ║ ╠════════════════════════════════════════╩════════════════════════════════════════╣ ║ This is some really really really really really really really really really tha ║ ║ t is going to wrap to the next line ║ ╚═════════════════════════════════════════════════════════════════════════════════╝
Structs§
- Cell
- A table cell containing some str content.
- Row
- A set of table cells
- Table
- A set of rows containing data
- Table
Style - A set of characters which make up a table style
Enums§
- Alignment
- Represents the horizontal alignment of content within a cell.
- RowPosition
- Represents the vertical position of a row
Traits§
- IntoRow
- A trait for types that know how to turn themselves into a table row.