summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md6
-rw-r--r--examples/style.rs6
-rw-r--r--src/cell.rs4
-rw-r--r--src/lib.rs2
-rw-r--r--src/main.rs4
-rw-r--r--src/row.rs8
6 files changed, 15 insertions, 15 deletions
diff --git a/README.md b/README.md
index 84190c7..2f988b2 100644
--- a/README.md
+++ b/README.md
@@ -148,7 +148,7 @@ With macros it's even simpler :
In rows, for each cells :
```rust
-row![FrByb:"ABC", FrByb:"DEFG", "HIJKLMN"];
+row![FrByb->"ABC", FrByb->"DEFG", "HIJKLMN"];
```
Or for the whole row :
```rust
@@ -156,7 +156,7 @@ row![FY => "styled", "bar", "foo"];
```
In tables, for each cells :
```rust
-table!([FrBybl:"A", FrBybc:"B", FrBybr:"C"], [123, 234, 345, 456]);
+table!([FrBybl->"A", FrBybc->"B", FrBybr->"C"], [123, 234, 345, 456]);
```
Or for each rows :
```rust
@@ -164,7 +164,7 @@ table!([Frb => "A", "B", "C"], [Frb => 1, 2, 3, 4], [1, 2, 3]);
```
Or a mix :
```rust
-table!([Frb => "A", "B", "C"], [Frb:1, Fgi:2, 3, 4], [1, 2, 3]);
+table!([Frb => "A", "B", "C"], [Frb->1, Fgi->2, 3, 4], [1, 2, 3]);
```
### List of style specifiers :
diff --git a/examples/style.rs b/examples/style.rs
index b209060..14cf6e7 100644
--- a/examples/style.rs
+++ b/examples/style.rs
@@ -11,7 +11,7 @@ fn main() {
let _ = table!();
let mut table = Table::new();
// Add style to a cell
- table.add_row(row![FrByb:"ABC", "DEFG", "HIJKLMN"]);
+ table.add_row(row![FrByb->"ABC", "DEFG", "HIJKLMN"]);
// Add style to a full row
table.add_row(row![FY => "styled", "bar", "foo"]);
table.add_row(Row::new(vec![
@@ -21,14 +21,14 @@ fn main() {
// Create a cell with red foreground color, yellow background color, with bold characters
Cell::new("foo2").style_spec("FrByb"),
// Using the cell! macro
- cell!(Fr:"red")])
+ cell!(Fr->"red")])
);
table.printstd();
// Print a table with some styles on it :
// FrBybl means : Foregound red, Background yellow, bold, left align
- ptable!([FrBybl:"A", "B", FrBybr:"C"], [123, 234, 345, 456], [Fg => 1, 2, 3]);
+ ptable!([FrBybl->"A", "B", FrBybr->"C"], [123, 234, 345, 456], [Fg => 1, 2, 3]);
// You can also apply style to full rows :
let mut table = table!([Frb => "A", "B", "C"], [1, 2, 3, 4], ["A\nBCCZZZ\nDDD", 2, table]);
diff --git a/src/cell.rs b/src/cell.rs
index 40bddd5..7fa6ed3 100644
--- a/src/cell.rs
+++ b/src/cell.rs
@@ -253,7 +253,7 @@ impl Default for Cell {
/// // Do something with the cell
/// # drop(cell);
/// // Create a cell with style (Red foreground, Bold, aligned to left);
-/// let styled = cell!(Frbl:"value");
+/// let styled = cell!(Frbl->"value");
/// # drop(styled);
/// # }
/// ```
@@ -261,7 +261,7 @@ impl Default for Cell {
macro_rules! cell {
() => ($crate::cell::Cell::default());
($value:expr) => ($crate::cell::Cell::new(&$value.to_string()));
- ($style:ident : $value:expr) => (cell!($value).style_spec(stringify!($style)));
+ ($style:ident -> $value:expr) => (cell!($value).style_spec(stringify!($style)));
}
#[cfg(test)]
diff --git a/src/lib.rs b/src/lib.rs
index 7c67b72..c20b91c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -417,7 +417,7 @@ impl <'a, T, E> Slice<'a, E> for T where T: AsRef<TableSlice<'a>>, [Row]: Index<
/// ```
/// # #[macro_use] extern crate prettytable;
/// # fn main() {
-/// let tab = table!([FrByl:"Element1", Fgc:"Element2", "Element3"],
+/// let tab = table!([FrByl->"Element1", Fgc->"Element2", "Element3"],
/// [FrBy => 1, 2, 3],
/// ["A", "B", "C"]
/// );
diff --git a/src/main.rs b/src/main.rs
index f5cba05..f75a4df 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -14,7 +14,7 @@ use term::{Attr, color};
fn main() {
let _ = table!();
let mut table = Table::new();
- table.add_row(row![FrByb:"ABC", "DEFG", "HIJKLMN"]);
+ table.add_row(row![FrByb->"ABC", "DEFG", "HIJKLMN"]);
table.add_row(row!["foobar", "bar", "foo"]);
table.add_row(row![]);
// Add style to a full row
@@ -40,7 +40,7 @@ fn main() {
// Print a table with some styles on it :
// FrBybl means : Foregound red, Background yellow, bold, left align
// d means : Default, do nothing
- ptable!([FrBybl:"A", "B", FrBybr:"C"], [d:123, 234, 345, 456]);
+ ptable!([FrBybl->"A", "B", FrBybr->"C"], [d->123, 234, 345, 456]);
// You can also apply style to full rows :
let mut table = table!([Frb => "A", "B", "C"], [1, 2, 3, 4], ["A\nBCCZZZ\nDDD", 2, table]);
diff --git a/src/row.rs b/src/row.rs
index 6c1d772..dd1dff5 100644
--- a/src/row.rs
+++ b/src/row.rs
@@ -170,7 +170,7 @@ impl <T, A> From<T> for Row where A: ToString, T : IntoIterator<Item=A> {
/// // bold, italic, align in the center of the cell
/// let row2 = row![FrBybic => "Element 1", "Element 2", "Element 3"];
/// // Create a row with first cell in blue, second one in red, and last one with default style
-/// let row3 = row![Fb:"blue", Fr:"red", "normal"];
+/// let row3 = row![Fb->"blue", Fr->"red", "normal"];
/// // Do something with rows
/// # drop(row1);
/// # drop(row2);
@@ -183,10 +183,10 @@ impl <T, A> From<T> for Row where A: ToString, T : IntoIterator<Item=A> {
macro_rules! row {
(($($out:tt)*); $value:expr) => (vec![$($out)* cell!($value)]);
(($($out:tt)*); $value:expr, $($n:tt)*) => (row!(($($out)* cell!($value),); $($n)*));
- (($($out:tt)*); $style:ident : $value:expr) => (vec![$($out)* cell!($style : $value)]);
- (($($out:tt)*); $style:ident : $value:expr, $($n: tt)*) => (row!(($($out)* cell!($style : $value),); $($n)*));
+ (($($out:tt)*); $style:ident -> $value:expr) => (vec![$($out)* cell!($style -> $value)]);
+ (($($out:tt)*); $style:ident -> $value:expr, $($n: tt)*) => (row!(($($out)* cell!($style -> $value),); $($n)*));
($($content:expr), *) => ($crate::row::Row::new(vec![$(cell!($content)), *]));
- ($style:ident => $($content:expr), *) => ($crate::row::Row::new(vec![$(cell!($style : $content)), *]));
+ ($style:ident => $($content:expr), *) => ($crate::row::Row::new(vec![$(cell!($style -> $content)), *]));
($($content:tt)*) => ($crate::row::Row::new(row!((); $($content)*)));
}