summaryrefslogtreecommitdiffstats
path: root/vendor/tabled/examples/compact_table_2.rs
blob: 5f231ccd8c5064f3c0d91939fbd63c3600a8c463 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
//! This example demonstrates creating a [`CompactTable`] `from()` a
//! multidimensional array.
//!
//! * Note how [`CompactTable::from()`] inherits the lengths of the nested arrays
//! as typed definitions through [const generics](https://practice.rs/generics-traits/const-generics.html).

use tabled::{settings::Style, tables::CompactTable};

fn main() {
    let data = [
        ["Debian", "1.1.1.1", "true"],
        ["Arch", "127.1.1.1", "true"],
        ["Manjaro", "Arch", "true"],
    ];

    let _table = CompactTable::from(data).with(Style::psql());

    #[cfg(feature = "std")]
    println!("{}", _table.to_string());
}