pub struct FancyTable<'a, T: AsRef<str>> { /* private fields */ }Implementations§
source§impl<'a, T: AsRef<str>> FancyTable<'a, T>
impl<'a, T: AsRef<str>> FancyTable<'a, T>
sourcepub fn create(opts: FancyTableOpts) -> FancyTableBuilder<'a, T>
pub fn create(opts: FancyTableOpts) -> FancyTableBuilder<'a, T>
Examples found in repository?
examples/minimal.rs (lines 4-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 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_wrapping_column_named_with_align("CHARACTER", Layout::Fixed(11), Align::Center)
.add_column_named_with_align("BADNESS SCALE", Layout::Expandable(15), Align::Center)
.add_wrapping_column_named_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
examples/modern.rs (line 4)
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_wrapping_column_named_with_align("CHARACTER", Layout::Fixed(11), Align::Center)
.add_column_named_with_align("BADNESS SCALE", Layout::Expandable(15), Align::Center)
.add_wrapping_column_named_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.",
]
]);
}examples/simple.rs (lines 4-7)
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 34
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_wrapping_column_named_with_align("CHARACTER", Layout::Fixed(11), Align::Center)
.add_column_named_with_align("BADNESS SCALE", Layout::Expandable(15), Align::Center)
.add_wrapping_column_named_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 (lines 4-7)
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 34
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_wrapping_column_named_with_align("CHARACTER", Layout::Fixed(11), Align::Center)
.add_column_named_with_align("BADNESS SCALE", Layout::Expandable(15), Align::Center)
.add_wrapping_column_named_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.",
]
]);
}sourcepub fn render<R: AsRef<[T]>>(&self, rows: Vec<R>)
pub fn render<R: AsRef<[T]>>(&self, rows: Vec<R>)
Examples found in repository?
examples/minimal.rs (lines 17-32)
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_wrapping_column_named_with_align("CHARACTER", Layout::Fixed(11), Align::Center)
.add_column_named_with_align("BADNESS SCALE", Layout::Expandable(15), Align::Center)
.add_wrapping_column_named_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
examples/modern.rs (lines 16-31)
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_wrapping_column_named_with_align("CHARACTER", Layout::Fixed(11), Align::Center)
.add_column_named_with_align("BADNESS SCALE", Layout::Expandable(15), Align::Center)
.add_wrapping_column_named_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.",
]
]);
}examples/simple.rs (lines 18-33)
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 34
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_wrapping_column_named_with_align("CHARACTER", Layout::Fixed(11), Align::Center)
.add_column_named_with_align("BADNESS SCALE", Layout::Expandable(15), Align::Center)
.add_wrapping_column_named_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 (lines 18-33)
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 34
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_wrapping_column_named_with_align("CHARACTER", Layout::Fixed(11), Align::Center)
.add_column_named_with_align("BADNESS SCALE", Layout::Expandable(15), Align::Center)
.add_wrapping_column_named_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.",
]
]);
}Auto Trait Implementations§
impl<'a, T> Freeze for FancyTable<'a, T>
impl<'a, T> RefUnwindSafe for FancyTable<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for FancyTable<'a, T>where
T: Send,
impl<'a, T> Sync for FancyTable<'a, T>where
T: Sync,
impl<'a, T> Unpin for FancyTable<'a, T>where
T: Unpin,
impl<'a, T> UnwindSafe for FancyTable<'a, T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more