span/
span.rs

1use prettytable::{format::Alignment, table, Cell, Row};
2
3fn main() {
4    /*
5        The following code will output
6
7        +---------------+---------------+--------------+
8        |         A table with horizontal span         |
9        +===============+===============+==============+
10        | This is a cell with span of 2 | span of 1    |
11        +---------------+---------------+--------------+
12        | span of 1     | span of 1     | span of 1    |
13        +---------------+---------------+--------------+
14        |    This cell with a span of 3 is centered    |
15        +---------------+---------------+--------------+
16    */
17
18    let mut table: prettytable::Table = table![
19    [H2 -> "This is a cell with span of 2", "span of 1"],
20    ["span of 1", "span of 1", "span of 1"],
21    [H03c -> "This cell with a span of 3 is centered"]
22    ];
23    table.set_titles(Row::new(vec![Cell::new_align(
24        "A table with horizontal span",
25        Alignment::CENTER,
26    )
27    .with_hspan(3)]));
28    table.printstd();
29}