Module tabled::settings

source ·
Expand description

Module contains various table configuration settings.

There 2 types of settings;

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

  • This module contains a Disable structure which helps to remove an etheir column or row from a Table.
  • This module contains a list of primitives to help to modify a Table.
  • This module contains settings for render strategy of papergrid.
  • The module contains Height structure which is responsible for a table and cell height.
  • This module contains a Highlight primitive, which helps changing a Border style of any segment on a Table.
  • The module contains a Location trait and implementations for it.
  • The module contains Measurement trait and its implementations to be used in Height and Width.;
  • The module contains a set of methods to merge cells together via Spans.
  • This module contains a list of primitives that implement a Object trait. They help to locate a necessary segment on a Table.
  • 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.
  • The module contains Peaker trait and its implementations to be used in Height and Width.
  • spanstd
    This module contains a Span settings, it helps to make a cell take more space then it generally takes.
  • This module contains a Split setting which is used to format the cells of a Table by a provided index, direction, behavior, and display preference.
  • This module contains a list of primitives which can be applied to change Table style.
  • 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.
  • 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 represents a color which can be set to things like Border, Padding and Margin.
  • Concat concatenates tables along a particular axis [Horizontal | Vertical]. It doesn’t do any key or column comparisons like SQL’s join does.
  • Dupstd
    Dup duplicates a given set of cells into another set of ones Table.
  • A marker structure to be able to create an empty Settings.
  • Returns a new Table that reflects a segment of the referenced Table
  • Margin is responsible for a left/right/top/bottom outer indent of a grid.
  • Modify structure provide an abstraction, to be able to apply a set of CellOptions to the same object.
  • This is a container of CellOptions which are applied to a set Object.
  • 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 TableOptions.
  • The structure represents a shadow of a table.

Enums

  • Rotate can be used to rotate a table by 90 degrees.

Traits