diff options
-rw-r--r-- | TODO.md | 1 | ||||
-rw-r--r-- | examples/basic.rs | 6 | ||||
-rw-r--r-- | src/lib.rs | 4 | ||||
-rw-r--r-- | src/main.rs | 3 |
4 files changed, 11 insertions, 3 deletions
@@ -12,5 +12,4 @@ * Learn how to do unit testing in Rust, and add some
## Travis-CI :
-* Publish doc in github pages
* Automatically publish API documentation with travis after each successfull build
diff --git a/examples/basic.rs b/examples/basic.rs index 3be3153..13cc661 100644 --- a/examples/basic.rs +++ b/examples/basic.rs @@ -40,4 +40,10 @@ fn main() { ["foobar", "bar", "foo"],
["foobar2", "bar2", "foo2"]
);
+
+ // Or directly print it like this
+ let _table = table!(["ABC", "DEFG", "HIJKLMN"],
+ ["foobar", "bar", "foo"],
+ ["foobar2", "bar2", "foo2"]
+ );
}
@@ -221,9 +221,9 @@ macro_rules! table { /// The syntax is the same that the one for the `table!` macro
#[macro_export]
macro_rules! ptable {
- ([$($value: expr), *]) => (
+ ($([$($value: expr), *]), *) => (
{
- let tab = table!([$($value), *]);
+ let tab = table!($([$($value), *]), *);
tab.printstd();
tab
}
diff --git a/src/main.rs b/src/main.rs index 6f48ae1..0096b5d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -19,9 +19,12 @@ fn main() { table.set_element(&"new_foo".to_string(), 2, 1).unwrap();
table.printstd();
+ ptable!(["A", "B", "C"], [1, 2, 3, 4]);
+
let mut table = table!(["A", "B", "C"], [1, 2, 3, 4], ["A\nBCCZZZ\nDDD", 2, table]);
table.set_titles(row!["Title 1", "Title 2"]);
table.set_format(FORMAT_DEFAULT);
table.printstd();
println!("{:?}", table);
+
}
|