tuple/tuple.rs
1//! This is the simplest example, showing how to print
2//! basic tuple types.
3
4use kitty_table::TableFormatter;
5
6pub fn main() {
7 // Create a table using the default formatter for (&str, i32, bool), the
8 // type we are supplying into it.
9 let table = TableFormatter::from_style();
10
11 // Put the data we want to print into a collection.
12 let data = [
13 ("Hello, world!", 2, true),
14 ("hello", 0, true),
15 ("meow", 123, false),
16 ];
17
18 // Call debug_print to write the output to console— use
19 // "let _ = ..." to ignore the output.
20 let _ = table.debug_print(data);
21}
22
23/*
24Expected result:
25
26┏━━━━━━━━━━━━━━━━━┯━━━━━┯━━━━━━━┓
27┃ "Hello, world!" │ 2 │ true ┃
28┠─────────────────┼─────┼───────┨
29┃ "hello" │ 0 │ true ┃
30┠─────────────────┼─────┼───────┨
31┃ "meow" │ 123 │ false ┃
32┗━━━━━━━━━━━━━━━━━┷━━━━━┷━━━━━━━┛
33*/