Expand description
Module contains various table configuration settings.
There 2 types of settings;
CellOption
which can modify only a cell.TableOption
which can modify table as a whole.
CellOption
works on behave of Modify
which is actually a TableOption
.
Notice that it’s possble to combine settings together by the help of Settings
.
use tabled::{Table, settings::{Settings, Style, Padding}};
let table_config = Settings::default()
.with(Padding::new(2, 2, 1, 1))
.with(Style::rounded());
let data = [[2023;9]; 3];
let table = Table::new(data).with(table_config).to_string();
assert_eq!(
table,
"╭────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────╮\n\
│ │ │ │ │ │ │ │ │ │\n\
│ 0 │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │\n\
│ │ │ │ │ │ │ │ │ │\n\
├────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┤\n\
│ │ │ │ │ │ │ │ │ │\n\
│ 2023 │ 2023 │ 2023 │ 2023 │ 2023 │ 2023 │ 2023 │ 2023 │ 2023 │\n\
│ │ │ │ │ │ │ │ │ │\n\
│ │ │ │ │ │ │ │ │ │\n\
│ 2023 │ 2023 │ 2023 │ 2023 │ 2023 │ 2023 │ 2023 │ 2023 │ 2023 │\n\
│ │ │ │ │ │ │ │ │ │\n\
│ │ │ │ │ │ │ │ │ │\n\
│ 2023 │ 2023 │ 2023 │ 2023 │ 2023 │ 2023 │ 2023 │ 2023 │ 2023 │\n\
│ │ │ │ │ │ │ │ │ │\n\
╰────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────╯"
)
Re-exports
pub use self::style::Border;
pub use self::style::Style;
pub use self::disable::Disable;
std
pub use self::format::Format;
std
pub use self::height::Height;
std
pub use self::highlight::Highlight;
std
pub use self::merge::Merge;
std
pub use self::panel::Panel;
std
pub use self::span::Span;
std
pub use self::themes::Theme;
std
pub use self::width::Width;
std
Modules
- disable
std
- format
std
This module contains a list of primitives to help to modify aTable
. - formatting
std
This module contains settings for render strategy of papergrid. - height
std
The module containsHeight
structure which is responsible for a table and cell height. - highlight
std
- location
std
The module contains aLocation
trait and implementations for it. - measurement
std
- merge
std
The module contains a set of methods to merge cells together viaSpan
s. - object
std
- panel
std
This module contains primitives to create a spread row. Ultimately it is a cell with a span set to a number of columns on theTable
. - peaker
std
- span
std
This module contains aSpan
settings, it helps to make a cell take more space then it generally takes. - split
std
- This module contains a list of primitives which can be applied to change
Table
style. - themes
std
The module contains a varieity of configurations of table, which often changes not a single setting. As such they are making relatively big changes to the configuration. - width
std
This module contains object which can be used to limit a cell to a given width:
Structs
- Alignment represent a horizontal and vertical alignment setting for any cell on a
Table
. - Color
std
- Concat
std
Concat
concatenates tables along a particular axis [Horizontal | Vertical]. It doesn’t do any key or column comparisons like SQL’s join does. - Dup
std
- A marker structure to be able to create an empty
Settings
. - Margin is responsible for a left/right/top/bottom outer indent of a grid.
- Modify
std
Modify structure provide an abstraction, to be able to apply a set ofCellOption
s to the same object. - ModifyList
std
This is a container ofCellOption
s which are applied to a setObject
. - Padding is responsible for a left/right/top/bottom inner indent of a particular cell.
- Reverse data on the table.
- Settings is a combinator of
TableOption
s. - Shadow
std
The structure represents a shadow of a table.
Enums
- Rotate can be used to rotate a table by 90 degrees.
Traits
- A trait for configuring a single cell.
- A trait which is responsible for configuration of a
Table
.