Expand description
Module contains various table configuration settings.
There 2 types of settings;
CellOptionwhich can modify only a cell.TableOptionwhich 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
Removestructure 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
Heightstructure which is responsible for a table and cell height. - highlight
- This module contains a
Highlightprimitive, which helps changing aBorderstyle of any segment on aTable. - location
- The module contains a
Locationtrait and implementations for it. - measurement
- The module contains
Measurementtrait and its implementations to be used inHeightandWidth.; - merge
- The module contains a set of methods to merge cells together via
Spans. - object
- This module contains a list of primitives that implement a
Objecttrait.
They help to locate a necessary segment on aTable. - padding_
expand - This module contains a
PaddingExpandsetting 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
PriorityandPeakertrait, its implementations to be used inHeightandWidth. - span
- This module contains a
Spansettings, it helps to make a cell take more space then it generally takes. - split
- This module contains a
Splitsetting which is used to format the cells of aTableby a provided index, direction, behavior, and display preference. - style
- This module contains a list of primitives which can be applied to change
Tablestyle. - 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,PaddingandMargin. - Concat
Concatconcatenates tables along a particular axis [Horizontal | Vertical]. It doesn’t do any key or column comparisons like SQL’s join does.- Dup
Dupduplicates 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
Tablethat 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
CellOptions to the same object. - Modify
List - This is a container of
CellOptions 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
TableOptions. - 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.