Crate term_table[−][src]
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::cell::Cell::new_with_alignment("This is some centered text", 2, term_table::cell::Alignment::Center) ])); table.add_row(term_table::row::Row::new(vec![ term_table::cell::Cell::new("This is left aligned text", 1), term_table::cell::Cell::new_with_alignment("This is right aligned text", 1, term_table::cell::Alignment::Right) ])); table.add_row(term_table::row::Row::new(vec![ term_table::cell::Cell::new("This is left aligned text", 1), term_table::cell::Cell::new_with_alignment("This is right aligned text", 1, term_table::cell::Alignment::Right) ])); table.add_row(term_table::row::Row::new(vec![ term_table::cell::Cell::new("This is some really really really really really really really really really that is going to wrap to the next line", 2), ])); println!("{}", table.as_string());
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
cell | |
row |
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 |