[−][src]Crate term_table
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
let mut table = term_table::Table::new(); table.max_column_width = 40; table.style = term_table::TableStyle::extended(); table.add_row(term_table::row::Row::new(vec![ term_table::table_cell::TableCell::new_with_alignment("This is some centered text", 2, term_table::table_cell::Alignment::Center) ])); table.add_row(term_table::row::Row::new(vec![ term_table::table_cell::TableCell::new("This is left aligned text"), term_table::table_cell::TableCell::new_with_alignment("This is right aligned text", 1, term_table::table_cell::Alignment::Right) ])); table.add_row(term_table::row::Row::new(vec![ term_table::table_cell::TableCell::new("This is left aligned text"), term_table::table_cell::TableCell::new_with_alignment("This is right aligned text", 1, term_table::table_cell::Alignment::Right) ])); table.add_row(term_table::row::Row::new(vec![ term_table::table_cell::TableCell::new_with_col_span("This is some really really really really really really really really really that is going to wrap to the next line", 2), ])); println!("{}", table.render());
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 ║ ╚═════════════════════════════════════════════════════════════════════════════════╝
Modules
row | |
table_cell |
Structs
Table | A set of rows containing data |
TableStyle | A set of characters which make up a table style |
Enums
RowPosition | Represents the vertical postion of a row |