fancy_table

Struct FancyTableBuilder

source
pub struct FancyTableBuilder<'a, T: AsRef<str>> { /* private fields */ }

Implementations§

source§

impl<'a, T: AsRef<str>> FancyTableBuilder<'a, T>

source

pub fn add_column( self, header: Option<T>, layout: Layout, align: Align, overflow: Overflow, max_lines: usize, ) -> Self

source

pub fn add_column_named(self, header: T, layout: Layout) -> Self

Examples found in repository?
examples/minimal.rs (line 9)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
fn main() {
    let table = FancyTable::create(FancyTableOpts {
        charset: Charset::Minimal,
        max_lines: 5,
        ..Default::default()
    })
    .add_column_named("ID", Layout::Slim)
    .add_column_named("NAME", Layout::Fixed(16))
    .add_column_named_wrapping_with_align("CHARACTER", Layout::Fixed(11), Align::Center)
    .add_column_named_with_align("BADNESS SCALE", Layout::Expandable(15), Align::Center)
    .add_column_named_wrapping_with_align("DESCRIPTION", Layout::Expandable(150), Align::Right)
    .hseparator(Some(Separator::Single))
    .build(80);

    table.render(vec![
        [
            "1",
            "Maeglin",
            "Elf",
            "Renegade\n10/10",
            "Maeglin is an elf who betrayed his fellow elves to the evil Morgoth in an age before The Lord of the Rings.",
        ],
        [
            "29",
            "Tauriel",
            "Woodland elf",
            "Tearjerker\n1/10",
            "Tauriel is a woodland elf created for The Hobbit films. Her name means \"daughter of the forest\" in Sindarin.",
        ]
    ]);
}
More examples
Hide additional examples
examples/simple.rs (line 11)
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
fn main() {
    let table = FancyTable::create(FancyTableOpts {
        charset: Charset::Simple,
        ..Default::default()
    })
    .add_title_with_align("props", TitleAlign::RightOffset(1))
    .add_column_named("ID", Layout::Slim)
    .add_column_named("NAME", Layout::Fixed(16))
    .add_column_named_wrapping_with_align("CHARACTER", Layout::Fixed(11), Align::Center)
    .add_column_named_with_align("BADNESS SCALE", Layout::Expandable(15), Align::Center)
    .add_column_named_wrapping_with_align("DESCRIPTION", Layout::Expandable(150), Align::Right)
    .hseparator(Some(Separator::Single))
    .padding(1)
    .build(80);

    table.render(vec![
        [
            "1",
            "Maeglin",
            "Elf",
            "Renegade\n10/10",
            "Maeglin is an elf who betrayed his fellow elves to the evil Morgoth in an age before The Lord of the Rings.",
        ],
        [
            "29",
            "Tauriel",
            "Woodland elf",
            "Tearjerker\n1/10",
            "Tauriel is a woodland elf created for The Hobbit films. Her name means \"daughter of the forest\" in Sindarin.",
        ]
    ]);
}
examples/classic.rs (line 11)
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
fn main() {
    let table = FancyTable::create(FancyTableOpts {
        charset: Charset::Classic,
        ..Default::default()
    })
    .add_title_with_align("props", TitleAlign::RightOffset(1))
    .add_column_named("ID", Layout::Slim)
    .add_column_named("NAME", Layout::Fixed(16))
    .add_column_named_wrapping_with_align("CHARACTER", Layout::Fixed(11), Align::Center)
    .add_column_named_with_align("BADNESS SCALE", Layout::Expandable(15), Align::Center)
    .add_column_named_wrapping_with_align("DESCRIPTION", Layout::Expandable(150), Align::Right)
    .hseparator(Some(Separator::Single))
    .padding(3)
    .build(80);

    table.render(vec![
        [
            "29",
            "Tauriel",
            "Woodland elf",
            "Tearjerker\n1/10",
            "Tauriel is a woodland elf created for The Hobbit films. Her name means \"daughter of the forest\" in Sindarin.",
        ],
        [
            "1",
            "Maeglin",
            "Elf",
            "Renegade\n10/10",
            "Maeglin is an elf who betrayed his fellow elves to the evil Morgoth in an age before The Lord of the Rings.",
        ]
    ]);
}
examples/modern.rs (line 6)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
fn main() {
    let table = FancyTable::create(FancyTableOpts::default())
        .add_title_with_align("props", TitleAlign::RightOffset(1))
        .add_column_named("ID", Layout::Slim)
        .add_column_named("NAME", Layout::Fixed(16))
        .add_column_named_wrapping_with_align("CHARACTER", Layout::Fixed(11), Align::Center)
        .add_column_named_with_align("BADNESS SCALE", Layout::Expandable(15), Align::Center)
        .add_column_named_wrapping_with_align("DESCRIPTION", Layout::Expandable(150), Align::Right)
        .padding(1)
        .hseparator(Some(Separator::Double))
        .rseparator(Some(Separator::Custom('┄')))
        .build(80);

    table.render(vec![
        [
            "1",
            "Maeglin",
            "Elf",
            "Renegade\n10/10",
            "Maeglin is an elf who betrayed his fellow elves to the evil Morgoth in an age before The Lord of the Rings.",
        ],
        [
            "29",
            "Tauriel",
            "Woodland elf",
            "Tearjerker\n1/10",
            "Tauriel is a woodland elf created for The Hobbit films. Her name means \"daughter of the forest\" in Sindarin.",
        ]
    ]);
}
source

pub fn add_column_named_wrapping(self, header: T, layout: Layout) -> Self

source

pub fn add_column_named_with_align( self, header: T, layout: Layout, align: Align, ) -> Self

Examples found in repository?
examples/minimal.rs (line 12)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
fn main() {
    let table = FancyTable::create(FancyTableOpts {
        charset: Charset::Minimal,
        max_lines: 5,
        ..Default::default()
    })
    .add_column_named("ID", Layout::Slim)
    .add_column_named("NAME", Layout::Fixed(16))
    .add_column_named_wrapping_with_align("CHARACTER", Layout::Fixed(11), Align::Center)
    .add_column_named_with_align("BADNESS SCALE", Layout::Expandable(15), Align::Center)
    .add_column_named_wrapping_with_align("DESCRIPTION", Layout::Expandable(150), Align::Right)
    .hseparator(Some(Separator::Single))
    .build(80);

    table.render(vec![
        [
            "1",
            "Maeglin",
            "Elf",
            "Renegade\n10/10",
            "Maeglin is an elf who betrayed his fellow elves to the evil Morgoth in an age before The Lord of the Rings.",
        ],
        [
            "29",
            "Tauriel",
            "Woodland elf",
            "Tearjerker\n1/10",
            "Tauriel is a woodland elf created for The Hobbit films. Her name means \"daughter of the forest\" in Sindarin.",
        ]
    ]);
}
More examples
Hide additional examples
examples/simple.rs (line 14)
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
fn main() {
    let table = FancyTable::create(FancyTableOpts {
        charset: Charset::Simple,
        ..Default::default()
    })
    .add_title_with_align("props", TitleAlign::RightOffset(1))
    .add_column_named("ID", Layout::Slim)
    .add_column_named("NAME", Layout::Fixed(16))
    .add_column_named_wrapping_with_align("CHARACTER", Layout::Fixed(11), Align::Center)
    .add_column_named_with_align("BADNESS SCALE", Layout::Expandable(15), Align::Center)
    .add_column_named_wrapping_with_align("DESCRIPTION", Layout::Expandable(150), Align::Right)
    .hseparator(Some(Separator::Single))
    .padding(1)
    .build(80);

    table.render(vec![
        [
            "1",
            "Maeglin",
            "Elf",
            "Renegade\n10/10",
            "Maeglin is an elf who betrayed his fellow elves to the evil Morgoth in an age before The Lord of the Rings.",
        ],
        [
            "29",
            "Tauriel",
            "Woodland elf",
            "Tearjerker\n1/10",
            "Tauriel is a woodland elf created for The Hobbit films. Her name means \"daughter of the forest\" in Sindarin.",
        ]
    ]);
}
examples/classic.rs (line 14)
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
fn main() {
    let table = FancyTable::create(FancyTableOpts {
        charset: Charset::Classic,
        ..Default::default()
    })
    .add_title_with_align("props", TitleAlign::RightOffset(1))
    .add_column_named("ID", Layout::Slim)
    .add_column_named("NAME", Layout::Fixed(16))
    .add_column_named_wrapping_with_align("CHARACTER", Layout::Fixed(11), Align::Center)
    .add_column_named_with_align("BADNESS SCALE", Layout::Expandable(15), Align::Center)
    .add_column_named_wrapping_with_align("DESCRIPTION", Layout::Expandable(150), Align::Right)
    .hseparator(Some(Separator::Single))
    .padding(3)
    .build(80);

    table.render(vec![
        [
            "29",
            "Tauriel",
            "Woodland elf",
            "Tearjerker\n1/10",
            "Tauriel is a woodland elf created for The Hobbit films. Her name means \"daughter of the forest\" in Sindarin.",
        ],
        [
            "1",
            "Maeglin",
            "Elf",
            "Renegade\n10/10",
            "Maeglin is an elf who betrayed his fellow elves to the evil Morgoth in an age before The Lord of the Rings.",
        ]
    ]);
}
examples/modern.rs (line 9)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
fn main() {
    let table = FancyTable::create(FancyTableOpts::default())
        .add_title_with_align("props", TitleAlign::RightOffset(1))
        .add_column_named("ID", Layout::Slim)
        .add_column_named("NAME", Layout::Fixed(16))
        .add_column_named_wrapping_with_align("CHARACTER", Layout::Fixed(11), Align::Center)
        .add_column_named_with_align("BADNESS SCALE", Layout::Expandable(15), Align::Center)
        .add_column_named_wrapping_with_align("DESCRIPTION", Layout::Expandable(150), Align::Right)
        .padding(1)
        .hseparator(Some(Separator::Double))
        .rseparator(Some(Separator::Custom('┄')))
        .build(80);

    table.render(vec![
        [
            "1",
            "Maeglin",
            "Elf",
            "Renegade\n10/10",
            "Maeglin is an elf who betrayed his fellow elves to the evil Morgoth in an age before The Lord of the Rings.",
        ],
        [
            "29",
            "Tauriel",
            "Woodland elf",
            "Tearjerker\n1/10",
            "Tauriel is a woodland elf created for The Hobbit films. Her name means \"daughter of the forest\" in Sindarin.",
        ]
    ]);
}
source

pub fn add_column_named_wrapping_with_align( self, header: T, layout: Layout, align: Align, ) -> Self

Examples found in repository?
examples/minimal.rs (line 11)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
fn main() {
    let table = FancyTable::create(FancyTableOpts {
        charset: Charset::Minimal,
        max_lines: 5,
        ..Default::default()
    })
    .add_column_named("ID", Layout::Slim)
    .add_column_named("NAME", Layout::Fixed(16))
    .add_column_named_wrapping_with_align("CHARACTER", Layout::Fixed(11), Align::Center)
    .add_column_named_with_align("BADNESS SCALE", Layout::Expandable(15), Align::Center)
    .add_column_named_wrapping_with_align("DESCRIPTION", Layout::Expandable(150), Align::Right)
    .hseparator(Some(Separator::Single))
    .build(80);

    table.render(vec![
        [
            "1",
            "Maeglin",
            "Elf",
            "Renegade\n10/10",
            "Maeglin is an elf who betrayed his fellow elves to the evil Morgoth in an age before The Lord of the Rings.",
        ],
        [
            "29",
            "Tauriel",
            "Woodland elf",
            "Tearjerker\n1/10",
            "Tauriel is a woodland elf created for The Hobbit films. Her name means \"daughter of the forest\" in Sindarin.",
        ]
    ]);
}
More examples
Hide additional examples
examples/simple.rs (line 13)
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
fn main() {
    let table = FancyTable::create(FancyTableOpts {
        charset: Charset::Simple,
        ..Default::default()
    })
    .add_title_with_align("props", TitleAlign::RightOffset(1))
    .add_column_named("ID", Layout::Slim)
    .add_column_named("NAME", Layout::Fixed(16))
    .add_column_named_wrapping_with_align("CHARACTER", Layout::Fixed(11), Align::Center)
    .add_column_named_with_align("BADNESS SCALE", Layout::Expandable(15), Align::Center)
    .add_column_named_wrapping_with_align("DESCRIPTION", Layout::Expandable(150), Align::Right)
    .hseparator(Some(Separator::Single))
    .padding(1)
    .build(80);

    table.render(vec![
        [
            "1",
            "Maeglin",
            "Elf",
            "Renegade\n10/10",
            "Maeglin is an elf who betrayed his fellow elves to the evil Morgoth in an age before The Lord of the Rings.",
        ],
        [
            "29",
            "Tauriel",
            "Woodland elf",
            "Tearjerker\n1/10",
            "Tauriel is a woodland elf created for The Hobbit films. Her name means \"daughter of the forest\" in Sindarin.",
        ]
    ]);
}
examples/classic.rs (line 13)
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
fn main() {
    let table = FancyTable::create(FancyTableOpts {
        charset: Charset::Classic,
        ..Default::default()
    })
    .add_title_with_align("props", TitleAlign::RightOffset(1))
    .add_column_named("ID", Layout::Slim)
    .add_column_named("NAME", Layout::Fixed(16))
    .add_column_named_wrapping_with_align("CHARACTER", Layout::Fixed(11), Align::Center)
    .add_column_named_with_align("BADNESS SCALE", Layout::Expandable(15), Align::Center)
    .add_column_named_wrapping_with_align("DESCRIPTION", Layout::Expandable(150), Align::Right)
    .hseparator(Some(Separator::Single))
    .padding(3)
    .build(80);

    table.render(vec![
        [
            "29",
            "Tauriel",
            "Woodland elf",
            "Tearjerker\n1/10",
            "Tauriel is a woodland elf created for The Hobbit films. Her name means \"daughter of the forest\" in Sindarin.",
        ],
        [
            "1",
            "Maeglin",
            "Elf",
            "Renegade\n10/10",
            "Maeglin is an elf who betrayed his fellow elves to the evil Morgoth in an age before The Lord of the Rings.",
        ]
    ]);
}
examples/modern.rs (line 8)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
fn main() {
    let table = FancyTable::create(FancyTableOpts::default())
        .add_title_with_align("props", TitleAlign::RightOffset(1))
        .add_column_named("ID", Layout::Slim)
        .add_column_named("NAME", Layout::Fixed(16))
        .add_column_named_wrapping_with_align("CHARACTER", Layout::Fixed(11), Align::Center)
        .add_column_named_with_align("BADNESS SCALE", Layout::Expandable(15), Align::Center)
        .add_column_named_wrapping_with_align("DESCRIPTION", Layout::Expandable(150), Align::Right)
        .padding(1)
        .hseparator(Some(Separator::Double))
        .rseparator(Some(Separator::Custom('┄')))
        .build(80);

    table.render(vec![
        [
            "1",
            "Maeglin",
            "Elf",
            "Renegade\n10/10",
            "Maeglin is an elf who betrayed his fellow elves to the evil Morgoth in an age before The Lord of the Rings.",
        ],
        [
            "29",
            "Tauriel",
            "Woodland elf",
            "Tearjerker\n1/10",
            "Tauriel is a woodland elf created for The Hobbit films. Her name means \"daughter of the forest\" in Sindarin.",
        ]
    ]);
}
source

pub fn add_title(self, title: &'a str) -> Self

source

pub fn add_title_with_align(self, title: &'a str, align: TitleAlign) -> Self

Examples found in repository?
examples/simple.rs (line 10)
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
fn main() {
    let table = FancyTable::create(FancyTableOpts {
        charset: Charset::Simple,
        ..Default::default()
    })
    .add_title_with_align("props", TitleAlign::RightOffset(1))
    .add_column_named("ID", Layout::Slim)
    .add_column_named("NAME", Layout::Fixed(16))
    .add_column_named_wrapping_with_align("CHARACTER", Layout::Fixed(11), Align::Center)
    .add_column_named_with_align("BADNESS SCALE", Layout::Expandable(15), Align::Center)
    .add_column_named_wrapping_with_align("DESCRIPTION", Layout::Expandable(150), Align::Right)
    .hseparator(Some(Separator::Single))
    .padding(1)
    .build(80);

    table.render(vec![
        [
            "1",
            "Maeglin",
            "Elf",
            "Renegade\n10/10",
            "Maeglin is an elf who betrayed his fellow elves to the evil Morgoth in an age before The Lord of the Rings.",
        ],
        [
            "29",
            "Tauriel",
            "Woodland elf",
            "Tearjerker\n1/10",
            "Tauriel is a woodland elf created for The Hobbit films. Her name means \"daughter of the forest\" in Sindarin.",
        ]
    ]);
}
More examples
Hide additional examples
examples/classic.rs (line 10)
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
fn main() {
    let table = FancyTable::create(FancyTableOpts {
        charset: Charset::Classic,
        ..Default::default()
    })
    .add_title_with_align("props", TitleAlign::RightOffset(1))
    .add_column_named("ID", Layout::Slim)
    .add_column_named("NAME", Layout::Fixed(16))
    .add_column_named_wrapping_with_align("CHARACTER", Layout::Fixed(11), Align::Center)
    .add_column_named_with_align("BADNESS SCALE", Layout::Expandable(15), Align::Center)
    .add_column_named_wrapping_with_align("DESCRIPTION", Layout::Expandable(150), Align::Right)
    .hseparator(Some(Separator::Single))
    .padding(3)
    .build(80);

    table.render(vec![
        [
            "29",
            "Tauriel",
            "Woodland elf",
            "Tearjerker\n1/10",
            "Tauriel is a woodland elf created for The Hobbit films. Her name means \"daughter of the forest\" in Sindarin.",
        ],
        [
            "1",
            "Maeglin",
            "Elf",
            "Renegade\n10/10",
            "Maeglin is an elf who betrayed his fellow elves to the evil Morgoth in an age before The Lord of the Rings.",
        ]
    ]);
}
examples/modern.rs (line 5)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
fn main() {
    let table = FancyTable::create(FancyTableOpts::default())
        .add_title_with_align("props", TitleAlign::RightOffset(1))
        .add_column_named("ID", Layout::Slim)
        .add_column_named("NAME", Layout::Fixed(16))
        .add_column_named_wrapping_with_align("CHARACTER", Layout::Fixed(11), Align::Center)
        .add_column_named_with_align("BADNESS SCALE", Layout::Expandable(15), Align::Center)
        .add_column_named_wrapping_with_align("DESCRIPTION", Layout::Expandable(150), Align::Right)
        .padding(1)
        .hseparator(Some(Separator::Double))
        .rseparator(Some(Separator::Custom('┄')))
        .build(80);

    table.render(vec![
        [
            "1",
            "Maeglin",
            "Elf",
            "Renegade\n10/10",
            "Maeglin is an elf who betrayed his fellow elves to the evil Morgoth in an age before The Lord of the Rings.",
        ],
        [
            "29",
            "Tauriel",
            "Woodland elf",
            "Tearjerker\n1/10",
            "Tauriel is a woodland elf created for The Hobbit films. Her name means \"daughter of the forest\" in Sindarin.",
        ]
    ]);
}
source

pub fn padding(self, padding: usize) -> Self

Examples found in repository?
examples/simple.rs (line 17)
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
fn main() {
    let table = FancyTable::create(FancyTableOpts {
        charset: Charset::Simple,
        ..Default::default()
    })
    .add_title_with_align("props", TitleAlign::RightOffset(1))
    .add_column_named("ID", Layout::Slim)
    .add_column_named("NAME", Layout::Fixed(16))
    .add_column_named_wrapping_with_align("CHARACTER", Layout::Fixed(11), Align::Center)
    .add_column_named_with_align("BADNESS SCALE", Layout::Expandable(15), Align::Center)
    .add_column_named_wrapping_with_align("DESCRIPTION", Layout::Expandable(150), Align::Right)
    .hseparator(Some(Separator::Single))
    .padding(1)
    .build(80);

    table.render(vec![
        [
            "1",
            "Maeglin",
            "Elf",
            "Renegade\n10/10",
            "Maeglin is an elf who betrayed his fellow elves to the evil Morgoth in an age before The Lord of the Rings.",
        ],
        [
            "29",
            "Tauriel",
            "Woodland elf",
            "Tearjerker\n1/10",
            "Tauriel is a woodland elf created for The Hobbit films. Her name means \"daughter of the forest\" in Sindarin.",
        ]
    ]);
}
More examples
Hide additional examples
examples/classic.rs (line 17)
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
fn main() {
    let table = FancyTable::create(FancyTableOpts {
        charset: Charset::Classic,
        ..Default::default()
    })
    .add_title_with_align("props", TitleAlign::RightOffset(1))
    .add_column_named("ID", Layout::Slim)
    .add_column_named("NAME", Layout::Fixed(16))
    .add_column_named_wrapping_with_align("CHARACTER", Layout::Fixed(11), Align::Center)
    .add_column_named_with_align("BADNESS SCALE", Layout::Expandable(15), Align::Center)
    .add_column_named_wrapping_with_align("DESCRIPTION", Layout::Expandable(150), Align::Right)
    .hseparator(Some(Separator::Single))
    .padding(3)
    .build(80);

    table.render(vec![
        [
            "29",
            "Tauriel",
            "Woodland elf",
            "Tearjerker\n1/10",
            "Tauriel is a woodland elf created for The Hobbit films. Her name means \"daughter of the forest\" in Sindarin.",
        ],
        [
            "1",
            "Maeglin",
            "Elf",
            "Renegade\n10/10",
            "Maeglin is an elf who betrayed his fellow elves to the evil Morgoth in an age before The Lord of the Rings.",
        ]
    ]);
}
examples/modern.rs (line 11)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
fn main() {
    let table = FancyTable::create(FancyTableOpts::default())
        .add_title_with_align("props", TitleAlign::RightOffset(1))
        .add_column_named("ID", Layout::Slim)
        .add_column_named("NAME", Layout::Fixed(16))
        .add_column_named_wrapping_with_align("CHARACTER", Layout::Fixed(11), Align::Center)
        .add_column_named_with_align("BADNESS SCALE", Layout::Expandable(15), Align::Center)
        .add_column_named_wrapping_with_align("DESCRIPTION", Layout::Expandable(150), Align::Right)
        .padding(1)
        .hseparator(Some(Separator::Double))
        .rseparator(Some(Separator::Custom('┄')))
        .build(80);

    table.render(vec![
        [
            "1",
            "Maeglin",
            "Elf",
            "Renegade\n10/10",
            "Maeglin is an elf who betrayed his fellow elves to the evil Morgoth in an age before The Lord of the Rings.",
        ],
        [
            "29",
            "Tauriel",
            "Woodland elf",
            "Tearjerker\n1/10",
            "Tauriel is a woodland elf created for The Hobbit films. Her name means \"daughter of the forest\" in Sindarin.",
        ]
    ]);
}
source

pub fn hseparator(self, separator: Option<Separator>) -> Self

Examples found in repository?
examples/minimal.rs (line 14)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
fn main() {
    let table = FancyTable::create(FancyTableOpts {
        charset: Charset::Minimal,
        max_lines: 5,
        ..Default::default()
    })
    .add_column_named("ID", Layout::Slim)
    .add_column_named("NAME", Layout::Fixed(16))
    .add_column_named_wrapping_with_align("CHARACTER", Layout::Fixed(11), Align::Center)
    .add_column_named_with_align("BADNESS SCALE", Layout::Expandable(15), Align::Center)
    .add_column_named_wrapping_with_align("DESCRIPTION", Layout::Expandable(150), Align::Right)
    .hseparator(Some(Separator::Single))
    .build(80);

    table.render(vec![
        [
            "1",
            "Maeglin",
            "Elf",
            "Renegade\n10/10",
            "Maeglin is an elf who betrayed his fellow elves to the evil Morgoth in an age before The Lord of the Rings.",
        ],
        [
            "29",
            "Tauriel",
            "Woodland elf",
            "Tearjerker\n1/10",
            "Tauriel is a woodland elf created for The Hobbit films. Her name means \"daughter of the forest\" in Sindarin.",
        ]
    ]);
}
More examples
Hide additional examples
examples/simple.rs (line 16)
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
fn main() {
    let table = FancyTable::create(FancyTableOpts {
        charset: Charset::Simple,
        ..Default::default()
    })
    .add_title_with_align("props", TitleAlign::RightOffset(1))
    .add_column_named("ID", Layout::Slim)
    .add_column_named("NAME", Layout::Fixed(16))
    .add_column_named_wrapping_with_align("CHARACTER", Layout::Fixed(11), Align::Center)
    .add_column_named_with_align("BADNESS SCALE", Layout::Expandable(15), Align::Center)
    .add_column_named_wrapping_with_align("DESCRIPTION", Layout::Expandable(150), Align::Right)
    .hseparator(Some(Separator::Single))
    .padding(1)
    .build(80);

    table.render(vec![
        [
            "1",
            "Maeglin",
            "Elf",
            "Renegade\n10/10",
            "Maeglin is an elf who betrayed his fellow elves to the evil Morgoth in an age before The Lord of the Rings.",
        ],
        [
            "29",
            "Tauriel",
            "Woodland elf",
            "Tearjerker\n1/10",
            "Tauriel is a woodland elf created for The Hobbit films. Her name means \"daughter of the forest\" in Sindarin.",
        ]
    ]);
}
examples/classic.rs (line 16)
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
fn main() {
    let table = FancyTable::create(FancyTableOpts {
        charset: Charset::Classic,
        ..Default::default()
    })
    .add_title_with_align("props", TitleAlign::RightOffset(1))
    .add_column_named("ID", Layout::Slim)
    .add_column_named("NAME", Layout::Fixed(16))
    .add_column_named_wrapping_with_align("CHARACTER", Layout::Fixed(11), Align::Center)
    .add_column_named_with_align("BADNESS SCALE", Layout::Expandable(15), Align::Center)
    .add_column_named_wrapping_with_align("DESCRIPTION", Layout::Expandable(150), Align::Right)
    .hseparator(Some(Separator::Single))
    .padding(3)
    .build(80);

    table.render(vec![
        [
            "29",
            "Tauriel",
            "Woodland elf",
            "Tearjerker\n1/10",
            "Tauriel is a woodland elf created for The Hobbit films. Her name means \"daughter of the forest\" in Sindarin.",
        ],
        [
            "1",
            "Maeglin",
            "Elf",
            "Renegade\n10/10",
            "Maeglin is an elf who betrayed his fellow elves to the evil Morgoth in an age before The Lord of the Rings.",
        ]
    ]);
}
examples/modern.rs (line 12)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
fn main() {
    let table = FancyTable::create(FancyTableOpts::default())
        .add_title_with_align("props", TitleAlign::RightOffset(1))
        .add_column_named("ID", Layout::Slim)
        .add_column_named("NAME", Layout::Fixed(16))
        .add_column_named_wrapping_with_align("CHARACTER", Layout::Fixed(11), Align::Center)
        .add_column_named_with_align("BADNESS SCALE", Layout::Expandable(15), Align::Center)
        .add_column_named_wrapping_with_align("DESCRIPTION", Layout::Expandable(150), Align::Right)
        .padding(1)
        .hseparator(Some(Separator::Double))
        .rseparator(Some(Separator::Custom('┄')))
        .build(80);

    table.render(vec![
        [
            "1",
            "Maeglin",
            "Elf",
            "Renegade\n10/10",
            "Maeglin is an elf who betrayed his fellow elves to the evil Morgoth in an age before The Lord of the Rings.",
        ],
        [
            "29",
            "Tauriel",
            "Woodland elf",
            "Tearjerker\n1/10",
            "Tauriel is a woodland elf created for The Hobbit films. Her name means \"daughter of the forest\" in Sindarin.",
        ]
    ]);
}
source

pub fn rseparator(self, separator: Option<Separator>) -> Self

Examples found in repository?
examples/modern.rs (line 13)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
fn main() {
    let table = FancyTable::create(FancyTableOpts::default())
        .add_title_with_align("props", TitleAlign::RightOffset(1))
        .add_column_named("ID", Layout::Slim)
        .add_column_named("NAME", Layout::Fixed(16))
        .add_column_named_wrapping_with_align("CHARACTER", Layout::Fixed(11), Align::Center)
        .add_column_named_with_align("BADNESS SCALE", Layout::Expandable(15), Align::Center)
        .add_column_named_wrapping_with_align("DESCRIPTION", Layout::Expandable(150), Align::Right)
        .padding(1)
        .hseparator(Some(Separator::Double))
        .rseparator(Some(Separator::Custom('┄')))
        .build(80);

    table.render(vec![
        [
            "1",
            "Maeglin",
            "Elf",
            "Renegade\n10/10",
            "Maeglin is an elf who betrayed his fellow elves to the evil Morgoth in an age before The Lord of the Rings.",
        ],
        [
            "29",
            "Tauriel",
            "Woodland elf",
            "Tearjerker\n1/10",
            "Tauriel is a woodland elf created for The Hobbit films. Her name means \"daughter of the forest\" in Sindarin.",
        ]
    ]);
}
source

pub fn build(self, table_width: usize) -> FancyTable<'a, T>

Examples found in repository?
examples/minimal.rs (line 15)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
fn main() {
    let table = FancyTable::create(FancyTableOpts {
        charset: Charset::Minimal,
        max_lines: 5,
        ..Default::default()
    })
    .add_column_named("ID", Layout::Slim)
    .add_column_named("NAME", Layout::Fixed(16))
    .add_column_named_wrapping_with_align("CHARACTER", Layout::Fixed(11), Align::Center)
    .add_column_named_with_align("BADNESS SCALE", Layout::Expandable(15), Align::Center)
    .add_column_named_wrapping_with_align("DESCRIPTION", Layout::Expandable(150), Align::Right)
    .hseparator(Some(Separator::Single))
    .build(80);

    table.render(vec![
        [
            "1",
            "Maeglin",
            "Elf",
            "Renegade\n10/10",
            "Maeglin is an elf who betrayed his fellow elves to the evil Morgoth in an age before The Lord of the Rings.",
        ],
        [
            "29",
            "Tauriel",
            "Woodland elf",
            "Tearjerker\n1/10",
            "Tauriel is a woodland elf created for The Hobbit films. Her name means \"daughter of the forest\" in Sindarin.",
        ]
    ]);
}
More examples
Hide additional examples
examples/simple.rs (line 18)
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
fn main() {
    let table = FancyTable::create(FancyTableOpts {
        charset: Charset::Simple,
        ..Default::default()
    })
    .add_title_with_align("props", TitleAlign::RightOffset(1))
    .add_column_named("ID", Layout::Slim)
    .add_column_named("NAME", Layout::Fixed(16))
    .add_column_named_wrapping_with_align("CHARACTER", Layout::Fixed(11), Align::Center)
    .add_column_named_with_align("BADNESS SCALE", Layout::Expandable(15), Align::Center)
    .add_column_named_wrapping_with_align("DESCRIPTION", Layout::Expandable(150), Align::Right)
    .hseparator(Some(Separator::Single))
    .padding(1)
    .build(80);

    table.render(vec![
        [
            "1",
            "Maeglin",
            "Elf",
            "Renegade\n10/10",
            "Maeglin is an elf who betrayed his fellow elves to the evil Morgoth in an age before The Lord of the Rings.",
        ],
        [
            "29",
            "Tauriel",
            "Woodland elf",
            "Tearjerker\n1/10",
            "Tauriel is a woodland elf created for The Hobbit films. Her name means \"daughter of the forest\" in Sindarin.",
        ]
    ]);
}
examples/classic.rs (line 18)
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
fn main() {
    let table = FancyTable::create(FancyTableOpts {
        charset: Charset::Classic,
        ..Default::default()
    })
    .add_title_with_align("props", TitleAlign::RightOffset(1))
    .add_column_named("ID", Layout::Slim)
    .add_column_named("NAME", Layout::Fixed(16))
    .add_column_named_wrapping_with_align("CHARACTER", Layout::Fixed(11), Align::Center)
    .add_column_named_with_align("BADNESS SCALE", Layout::Expandable(15), Align::Center)
    .add_column_named_wrapping_with_align("DESCRIPTION", Layout::Expandable(150), Align::Right)
    .hseparator(Some(Separator::Single))
    .padding(3)
    .build(80);

    table.render(vec![
        [
            "29",
            "Tauriel",
            "Woodland elf",
            "Tearjerker\n1/10",
            "Tauriel is a woodland elf created for The Hobbit films. Her name means \"daughter of the forest\" in Sindarin.",
        ],
        [
            "1",
            "Maeglin",
            "Elf",
            "Renegade\n10/10",
            "Maeglin is an elf who betrayed his fellow elves to the evil Morgoth in an age before The Lord of the Rings.",
        ]
    ]);
}
examples/modern.rs (line 14)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
fn main() {
    let table = FancyTable::create(FancyTableOpts::default())
        .add_title_with_align("props", TitleAlign::RightOffset(1))
        .add_column_named("ID", Layout::Slim)
        .add_column_named("NAME", Layout::Fixed(16))
        .add_column_named_wrapping_with_align("CHARACTER", Layout::Fixed(11), Align::Center)
        .add_column_named_with_align("BADNESS SCALE", Layout::Expandable(15), Align::Center)
        .add_column_named_wrapping_with_align("DESCRIPTION", Layout::Expandable(150), Align::Right)
        .padding(1)
        .hseparator(Some(Separator::Double))
        .rseparator(Some(Separator::Custom('┄')))
        .build(80);

    table.render(vec![
        [
            "1",
            "Maeglin",
            "Elf",
            "Renegade\n10/10",
            "Maeglin is an elf who betrayed his fellow elves to the evil Morgoth in an age before The Lord of the Rings.",
        ],
        [
            "29",
            "Tauriel",
            "Woodland elf",
            "Tearjerker\n1/10",
            "Tauriel is a woodland elf created for The Hobbit films. Her name means \"daughter of the forest\" in Sindarin.",
        ]
    ]);
}
source

pub fn build_with_max_width(self) -> FancyTable<'a, T>

Auto Trait Implementations§

§

impl<'a, T> Freeze for FancyTableBuilder<'a, T>

§

impl<'a, T> RefUnwindSafe for FancyTableBuilder<'a, T>
where T: RefUnwindSafe,

§

impl<'a, T> Send for FancyTableBuilder<'a, T>
where T: Send,

§

impl<'a, T> Sync for FancyTableBuilder<'a, T>
where T: Sync,

§

impl<'a, T> Unpin for FancyTableBuilder<'a, T>
where T: Unpin,

§

impl<'a, T> UnwindSafe for FancyTableBuilder<'a, T>
where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.