Crate format_table
source ·Expand description
Format tables with a stupid API.
Example:
let mut table = vec!["product\tquantity\tprice".to_string()];
for (p, q, r) in [("tomato", 12, 15), ("potato", 10, 20), ("rice", 5, 12)] {
table.push(format!("{}\t{}\t{}", p, q, r));
}
format_table::format_table(table);
A table to be formatted is a Vec<String>
, containing one string per line.
Table columns in each line are separated by a \t
character.
Functions
- Format a table and print the result to stdout.
- Format a table and return the result as a string.