Skip to main content

render_table

Function render_table 

Source
pub fn render_table(
    headers: &[&str],
    rows: &[Vec<String>],
    max_width: Option<usize>,
    styles: Option<&TableStyles>,
) -> String
Expand description

Render a table as ANSI-formatted terminal text.

headers — column headers (displayed in bold) rows — data rows, each being a Vec of cell strings max_width — optional terminal width to constrain total table width styles — optional custom styles

Auto-sizes columns based on content. Truncates cells that exceed their computed column width. Adds separator lines between header and body.