[−][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::{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
AsciiEscapedString | Simple string with ASCII escape sequences in it |
Headers | The Headers structure is a list of headers (per column) |
Table | The Table structure |
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 |
Traits
Unstyle | Trait to implement when a string length differs from its unstyled value length (ASCII escapes for instance) |