summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorPierre-Henri Symoneaux <pierre-henri.symoneaux@nokia.com>2017-05-29 20:35:04 +0200
committerPierre-Henri Symoneaux <pierre-henri.symoneaux@nokia.com>2017-05-29 20:35:04 +0200
commitc771c45b69de6b1c432e070cf6ac4d58c885488c (patch)
tree94f3026bdc92f2958b57aad3527895e7ac26e3b4 /examples
parent01db5497c5cd2d5020b6740b7a07cc626c8aa641 (diff)
Converted all indentation tabs to 4 spaces
Fixes #53
Diffstat (limited to 'examples')
-rw-r--r--examples/basic.rs52
-rw-r--r--examples/csv.rs16
-rw-r--r--examples/multiline.rs44
-rw-r--r--examples/style.rs22
4 files changed, 67 insertions, 67 deletions
diff --git a/examples/basic.rs b/examples/basic.rs
index 28c98e3..111328f 100644
--- a/examples/basic.rs
+++ b/examples/basic.rs
@@ -4,32 +4,32 @@ use prettytable::row::Row;
use prettytable::cell::Cell;
/*
- Following main function will print :
- +---------+------+---------+
- | ABC | DEFG | HIJKLMN |
- +---------+------+---------+
- | foobar | bar | foo |
- +---------+------+---------+
- | foobar2 | bar2 | foo2 |
- +---------+------+---------+
- Modified :
- +---------+------+---------+
- | ABC | DEFG | HIJKLMN |
- +---------+------+---------+
- | foobar | bar | foo |
- +---------+------+---------+
- | foobar2 | bar2 | new_foo |
- +---------+------+---------+
+ Following main function will print :
+ +---------+------+---------+
+ | ABC | DEFG | HIJKLMN |
+ +---------+------+---------+
+ | foobar | bar | foo |
+ +---------+------+---------+
+ | foobar2 | bar2 | foo2 |
+ +---------+------+---------+
+ Modified :
+ +---------+------+---------+
+ | ABC | DEFG | HIJKLMN |
+ +---------+------+---------+
+ | foobar | bar | foo |
+ +---------+------+---------+
+ | foobar2 | bar2 | new_foo |
+ +---------+------+---------+
*/
fn main() {
let mut table = Table::new();
table.add_row(row!["ABC", "DEFG", "HIJKLMN"]);
table.add_row(row!["foobar", "bar", "foo"]);
table.add_row(Row::new(vec![
- Cell::new("foobar2"),
- Cell::new("bar2"),
- Cell::new("foo2")])
- );
+ Cell::new("foobar2"),
+ Cell::new("bar2"),
+ Cell::new("foo2")])
+ );
table.printstd();
println!("Modified : ");
table.set_element("new_foo", 2, 1).unwrap();
@@ -37,13 +37,13 @@ fn main() {
// The same table can be built the following way :
let _table = table!(["ABC", "DEFG", "HIJKLMN"],
- ["foobar", "bar", "foo"],
- ["foobar2", "bar2", "foo2"]
- );
+ ["foobar", "bar", "foo"],
+ ["foobar2", "bar2", "foo2"]
+ );
// Or directly print it like this
let _table = ptable!(["ABC", "DEFG", "HIJKLMN"],
- ["foobar", "bar", "foo"],
- ["foobar2", "bar2", "foo2"]
- );
+ ["foobar", "bar", "foo"],
+ ["foobar2", "bar2", "foo2"]
+ );
}
diff --git a/examples/csv.rs b/examples/csv.rs
index f9202e7..68958ef 100644
--- a/examples/csv.rs
+++ b/examples/csv.rs
@@ -1,14 +1,14 @@
extern crate prettytable;
/*
- Following main function will print :
- +---------+------+---------+
- | ABC | DEFG | HIJKLMN |
- +---------+------+---------+
- | foobar | bar | foo |
- +---------+------+---------+
- | foobar2 | bar2 | foo2 |
- +---------+------+---------+
+ Following main function will print :
+ +---------+------+---------+
+ | ABC | DEFG | HIJKLMN |
+ +---------+------+---------+
+ | foobar | bar | foo |
+ +---------+------+---------+
+ | foobar2 | bar2 | foo2 |
+ +---------+------+---------+
ABC,DEFG,HIJKLMN
foobar,bar,foo
diff --git a/examples/multiline.rs b/examples/multiline.rs
index 709ecb0..3015fe6 100644
--- a/examples/multiline.rs
+++ b/examples/multiline.rs
@@ -1,31 +1,31 @@
#[macro_use] extern crate prettytable;
/*
- Following main function will print :
- +-------------------------+------------------------------+
- | Title 1 | Title 2 |
- +-------------------------+------------------------------+
- | This is | foo |
- | a multiline | |
- | cell | |
- +-------------------------+------------------------------+
- | Yo dawg ;) You can even | +---------+------+---------+ |
- | print tables | | ABC | DEFG | HIJKLMN | |
- | into tables | +---------+------+---------+ |
- | | | foobar | bar | foo | |
- | | +---------+------+---------+ |
- | | | foobar2 | bar2 | foo2 | |
- | | +---------+------+---------+ |
- +-------------------------+------------------------------+
+ Following main function will print :
+ +-------------------------+------------------------------+
+ | Title 1 | Title 2 |
+ +-------------------------+------------------------------+
+ | This is | foo |
+ | a multiline | |
+ | cell | |
+ +-------------------------+------------------------------+
+ | Yo 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"]
- );
+ ["foobar", "bar", "foo"],
+ ["foobar2", "bar2", "foo2"]
+ );
let table2 = table!(["Title 1", "Title 2"],
- ["This is\na multiline\ncell", "foo"],
- ["Yo dawg ;) You can even\nprint tables\ninto tables", table1]
- );
+ ["This is\na multiline\ncell", "foo"],
+ ["Yo dawg ;) You can even\nprint tables\ninto tables", table1]
+ );
table2.printstd();
}
diff --git a/examples/style.rs b/examples/style.rs
index 14cf6e7..8191372 100644
--- a/examples/style.rs
+++ b/examples/style.rs
@@ -8,29 +8,29 @@ use term::{Attr, color};
#[allow(dead_code)]
fn main() {
- let _ = table!();
+ let _ = table!();
let mut table = Table::new();
// Add style to a cell
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![
- Cell::new("foobar2"),
- // Create a cell with a red foreground color
- Cell::new("bar2").with_style(Attr::ForegroundColor(color::RED)),
- // 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::new("foobar2"),
+ // Create a cell with a red foreground color
+ Cell::new("bar2").with_style(Attr::ForegroundColor(color::RED)),
+ // 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")])
+ );
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 :
+ // 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]);
// Set a title line, with all text centered in the cell
table.set_titles(row![c => "Title 1", "Title 2"]);