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 possible 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::Remove;
pub use self::format::Format;
pub use self::height::Height;
pub use self::highlight::Highlight;
pub use self::merge::Merge;
pub use self::panel::Panel;
pub use self::span::Span;
pub use self::themes::Theme;
pub use self::width::Width;
Modules§
- disable
- This module contains a
Remove
structure which helps to remove an etheir column or row from aTable
. - format
- This module contains a list of primitives to help to modify a
Table
. - formatting
- This module contains settings for render strategy of papergrid.
- height
- The module contains
Height
structure which is responsible for a table and cell height. - highlight
- This module contains a
Highlight
primitive, which helps changing aBorder
style of any segment on aTable
. - location
- The module contains a
Location
trait and implementations for it. - measurement
- The module contains
Measurement
trait and its implementations to be used inHeight
andWidth
.; - merge
- The module contains a set of methods to merge cells together via
Span
s. - object
- This module contains a list of primitives that implement a
Object
trait.
They help to locate a necessary segment on aTable
. - padding_
expand - This module contains a
PaddingExpand
setting to expand cells padding to its limit a cell. - panel
- This module contains primitives to create a spread row.
Ultimately it is a cell with a span set to a number of columns on the
Table
. - peaker
- The module contains
Priority
andPeaker
trait, its implementations to be used inHeight
andWidth
. - span
- This module contains a
Span
settings, it helps to make a cell take more space then it generally takes. - split
- This module contains a
Split
setting which is used to format the cells of aTable
by a provided index, direction, behavior, and display preference. - style
- This module contains a list of primitives which can be applied to change
Table
style. - themes
- The module contains a variety of configurations of table, which often changes not a single setting. As such they are making relatively big changes to the configuration.
- width
- This module contains object which can be used to limit a cell to a given width:
Structs§
- Alignment
- Alignment represent a horizontal and vertical alignment setting for any cell on a
Table
. - Color
- Color represents a color which can be set to things like
Border
,Padding
andMargin
. - Concat
Concat
concatenates tables along a particular axis [Horizontal | Vertical]. It doesn’t do any key or column comparisons like SQL’s join does.- Dup
Dup
duplicates a given set of cells into another set of onesTable
.- Empty
Settings - A marker structure to be able to create an empty
Settings
. - Extract
- Returns a new
Table
that reflects a segment of the referencedTable
- Margin
- Margin is responsible for a left/right/top/bottom outer indent of a grid.
- Margin
Color - MarginColor is responsible for a left/right/top/bottom outer color of a grid.
- Modify
- Modify structure provide an abstraction, to be able to apply
a set of
CellOption
s to the same object. - Modify
List - This is a container of
CellOption
s which are applied to a setObject
. - Padding
- Padding is responsible for a left/right/top/bottom inner indent of a particular cell.
- Padding
Color - PaddingColor is responsible for a left/right/top/bottom inner color of a particular cell.
- Reverse
- Reverse data on the table.
- Settings
- Settings is a combinator of
TableOption
s. - Shadow
- The structure represents a shadow of a table.
Enums§
- Rotate
- Rotate can be used to rotate a table by 90 degrees.
Traits§
- Cell
Option - A trait for configuring a single cell.
- Table
Option - A trait which is responsible for configuration of a
Table
.