Crate stybulate[−][src]
Expand description
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::{Table, Style, Cell, Headers};
let result = Table::new(
Style::Fancy,
vec![
vec![Cell::from("answer"), Cell::Int(42)],
vec![Cell::from("pi"), Cell::Float(3.1415)],
],
Some(Headers::from(vec!["strings", "numbers"])),
).tabulate();
let expected = vec![
"╒═══════════╤═══════════╕",
"│ strings │ numbers │",
"╞═══════════╪═══════════╡",
"│ answer │ 42 │",
"├───────────┼───────────┤",
"│ pi │ 3.1415 │",
"╘═══════════╧═══════════╛",
].join("\n");
assert_eq!(expected, result);
Structs
Simple string with ASCII escape sequences in it
The Headers structure is a list of headers (per column)
The Table structure
Enums
The column alignments
The content of each cell of the table (either a string or a number)
The style of the table
Traits
Trait to implement when a string length differs from its unstyled value length (ASCII escapes for instance)