diff options
author | pierresy <pierre-henri.symoneaux@alcatel-lucent.com> | 2015-06-01 00:00:35 +0200 |
---|---|---|
committer | pierresy <pierre-henri.symoneaux@alcatel-lucent.com> | 2015-06-01 00:01:24 +0200 |
commit | a757b37d86eba14ef5a8cc3757dee994e3ce5b47 (patch) | |
tree | 055c54bb5a69ab14bc8e81ef1603d6078bc6e9bd /examples | |
parent | 69200996daad9158d2a20a9df16f892a218c9c55 (diff) |
* Manage multi line rows
* Capability to orint tables into tables (Yo dawg ;))
Diffstat (limited to 'examples')
-rw-r--r-- | examples/basic.rs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/examples/basic.rs b/examples/basic.rs index 459e89b..3996f4c 100644 --- a/examples/basic.rs +++ b/examples/basic.rs @@ -1,5 +1,7 @@ #[macro_use] extern crate tabprint;
use tabprint::Table;
+use tabprint::row::Row;
+use tabprint::cell::Cell;
/*
Following main function will print :
@@ -20,12 +22,16 @@ use tabprint::Table; +---------+------+---------+
*/
fn main() {
- let mut table = Table::new(vec!["ABC".to_string(), "DEFG".to_string(), "HIJKLMN".to_string()]);
- table.add_row(vec!["foobar".to_string(), "bar".to_string(), "foo".to_string()]).unwrap();
- table.add_row(vec!["foobar2".to_string(), "bar2".to_string(), "foo2".to_string()]).unwrap();
+ let mut table = Table::new(row!["ABC", "DEFG", "HIJKLMN"]);
+ table.add_row(row!["foobar", "bar", "foo"]).unwrap();
+ table.add_row(Row::new(vec![
+ Cell::new(&"foobar2".to_string()),
+ Cell::new(&"bar2".to_string()),
+ Cell::new(&"foo2".to_string())])
+ ).unwrap();
table.printstd();
println!("Modified : ");
- table.set_element("new_foo".to_string(), 2, 1).unwrap();
+ table.set_element(&"new_foo".to_string(), 2, 1).unwrap();
table.printstd();
// The same table can be built the following way :
|