summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorpierresy <pierre-henri.symoneaux@alcatel-lucent.com>2015-06-01 00:17:04 +0200
committerpierresy <pierre-henri.symoneaux@alcatel-lucent.com>2015-06-01 00:17:04 +0200
commite5ffc8a7e74bf508a2a096339a155bd39fdddd26 (patch)
tree4c4f34d043277a5042af507423af48d19d4999b7 /examples
parenta757b37d86eba14ef5a8cc3757dee994e3ce5b47 (diff)
Added multiline examples
Diffstat (limited to 'examples')
-rw-r--r--examples/multiline.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/examples/multiline.rs b/examples/multiline.rs
new file mode 100644
index 0000000..93b49fb
--- /dev/null
+++ b/examples/multiline.rs
@@ -0,0 +1,31 @@
+#[macro_use] extern crate tabprint;
+
+/*
+ Following main function will print :
+ +--------------------------+------------------------------+
+ | Title 1 | Title 2 |
+ +--------------------------+------------------------------+
+ | This is | foo |
+ | a multiline | |
+ | cell | |
+ +--------------------------+------------------------------+
+ | You dawg ;) You can even | +---------+------+---------+ |
+ | print tables | | ABC | DEFG | HIJKLMN | |
+ | into tables | +---------+------+---------+ |
+ | | | foobar | bar | foo | |
+ | | +---------+------+---------+ |
+ | | | foobar2 | bar2 | foo2 | |
+ | | +---------+------+---------+ |
+ +--------------------------+------------------------------+
+*/
+fn main() {
+ let table1 = table!(["ABC", "DEFG", "HIJKLMN"],
+ ["foobar", "bar", "foo"],
+ ["foobar2", "bar2", "foo2"]
+ );
+ let table2 = table!(["Title 1", "Title 2"],
+ ["This is\na multiline\ncell", "foo"],
+ ["You dawg ;) You can even\nprint tables\ninto tables", table1]
+ );
+ table2.printstd();
+}