tobble/table_render_opts

Configure the way your table is rendered. Every function in this module will return an Option type that can be passed to the render functions of the tobble module.

Types

pub opaque type Option

Functions

pub fn column_width(width: Int) -> Option

Render the table where each column’s text has the given width. If a width less than 1 is given, this will default to 1. By default, columns are as wide as the longest row within them.

pub fn hide_title() -> Option

Render a table that has a title set, but without its title.

pub fn horizontal_rules_after_every_row() -> Option

Renders the table with every row the header having a horizontal rule beneath it.

+---------+--------------+
|         | Output       |
+---------+--------------+
| Stage 1 | Wibble       |
+---------+--------------+
| Stage 2 | Wobble       |
+---------+--------------+
| Stage 3 | WibbleWobble |
+---------+--------------+
pub fn horizontal_rules_only_after_header() -> Option

Renders the table with only the header having a horizontal rule beneath it. This is the default setting.

+---------+--------------+
|         | Output       |
+---------+--------------+
| Stage 1 | Wibble       |
| Stage 2 | Wobble       |
| Stage 3 | WibbleWobble |
+---------+--------------+
pub fn line_type_ascii() -> Option

Render the table with ASCII characters for the borders. This is the default setting.

+---------+--------------+
|         | Output       |
+---------+--------------+
| Stage 1 | Wibble       |
| Stage 2 | Wobble       |
| Stage 3 | WibbleWobble |
+---------+--------------+
pub fn line_type_blank() -> Option

Renders the table with spaces for the borders. Note that this does not strip trailing spaces, the borders that you see in other line types are simply replaced with spaces. It will, however, remove the top and bottom borders for you.

            Output

  Stage 1   Wibble
  Stage 2   Wobble
  Stage 3   WibbleWobble
pub fn line_type_box_drawing_characters() -> Option

Renders the table with box drawing characters for the borders.

┌─────────┬──────────────┐
│         │ Output       │
├─────────┼──────────────┤
│ Stage 1 │ Wibble       │
│ Stage 2 │ Wobble       │
│ Stage 3 │ WibbleWobble │
└─────────┴──────────────┘
pub fn line_type_rounded_corner_box_drawing_characters() -> Option

Renders the table with box drawing characters for the borders, but with rounded corners.

╭─────────┬──────────────╮
│         │ Output       │
├─────────┼──────────────┤
│ Stage 1 │ Wibble       │
│ Stage 2 │ Wobble       │
│ Stage 3 │ WibbleWobble │
╰─────────┴──────────────╯
pub fn no_horizontal_rules() -> Option

Renders the table without any horizontal rules interleaved with the table’s rows.

+---------+--------------+
|         | Output       |
| Stage 1 | Wibble       |
| Stage 2 | Wobble       |
| Stage 3 | WibbleWobble |
+---------+--------------+
pub fn table_width(width: Int) -> Option

Render the table with a width of, at most, the given width. Note that this is best effort, and there are pathological cases where Tobble will decide to render your tables slightly wider than requested (e.g. requesting a width too small to even fit the table borders). By default, the table width is unconstrained.

pub fn title_position_bottom() -> Option

Place the title above the table. If the table does not have a title set, this option is ignored.

pub fn title_position_top() -> Option

Place the title above the table. If the table does not have a title set, this option is ignored. By default, the title will render at the top.

Search Document