Expand description
Console table rendering with Unicode/CJK-aware alignment, truncation, and ANSI color support.
§Example
use console_table::{Align, Style, Table};
let rows = vec![
vec!["#".to_string(), "source".to_string(), "latency".to_string()],
vec!["1".to_string(), "rsproxy".to_string(), "57 ms".to_string()],
vec!["2".to_string(), "tuna".to_string(), "16 ms".to_string()],
];
let table = Table::new(rows)
.style(Style::Boxed)
.aligns(vec![Align::Right, Align::Left, Align::Auto]);
println!("{}", table.render());Structs§
- Table
- Table configuration.
Enums§
Functions§
- display_
width - Terminal display width of
s, ignoring ANSI escape sequences. - is_
numeric_ like - Return
trueifslooks like a number, forAlign::Auto. - pad_
left_ with_ spaces - Pad
son the left with spaces up towidthdisplay columns. - pad_
right_ with_ spaces - Pad
son the right with spaces up towidthdisplay columns. - render_
table - Convenience function: render a table directly.
- strip_
ansi - Strip CSI-style ANSI escape sequences (e.g.
\x1b[...m) froms. - truncate_
visible - Truncate
sto at mostmax_widthdisplay columns, appending ASCII...(3 columns) on overflow.