multiline/multiline.rs
1use prettytable::table;
2/*
3 Following main function will print :
4 +-------------------------+------------------------------+
5 | Title 1 | Title 2 |
6 +-------------------------+------------------------------+
7 | This is | foo |
8 | a multiline | |
9 | cell | |
10 +-------------------------+------------------------------+
11 | Yo dawg ;) You can even | +---------+------+---------+ |
12 | print tables | | ABC | DEFG | HIJKLMN | |
13 | into tables | +---------+------+---------+ |
14 | | | foobar | bar | foo | |
15 | | +---------+------+---------+ |
16 | | | foobar2 | bar2 | foo2 | |
17 | | +---------+------+---------+ |
18 +-------------------------+------------------------------+
19*/
20fn main() {
21 let table1 = table!(
22 ["ABC", "DEFG", "HIJKLMN"],
23 ["foobar", "bar", "foo"],
24 ["foobar2", "bar2", "foo2"]
25 );
26 let table2 = table!(
27 ["Title 1", "Title 2"],
28 ["This is\na multiline\ncell", "foo"],
29 ["Yo dawg ;) You can even\nprint tables\ninto tables", table1]
30 );
31 table2.printstd();
32}