[][src]Crate stybulate

Stybulate : Tabulate with Style!

This library creates tables in ASCII with styled borders

References

It was inspired by the Python package https://pypi.org/project/tabulate/

Examples

use stybulate::{tabulate, Style, Cell};
let headers = vec!["strings", "numbers"];
let contents = vec![
    vec![Cell::Text("answer"), Cell::Int(42)],
    vec![Cell::Text("pi"), Cell::Float(3.1415)],
];
let expected = vec![
    "╒═══════════╤═══════════╕",
    "│ strings   │   numbers │",
    "╞═══════════╪═══════════╡",
    "│ answer    │   42      │",
    "├───────────┼───────────┤",
    "│ pi        │    3.1415 │",
    "╘═══════════╧═══════════╛",
].join("\n");
let table = tabulate(Style::Fancy, contents, headers);
assert_eq!(expected, table);

Enums

Align

The column alignments

Cell

The content of each cell of the table (either a string or a number)

Style

The style of the table

Functions

tabulate

Tabulate with default alignment (left for strings and decimal for numbers)

tabulate_with_align

Tabulate