| 1 | use comfy_tablerust-analyzer cargo comfy-table 7.2.2 crate/::{presetsrust-analyzer cargo comfy-table 7.2.2 style/presets/::UTF8_FULLrust-analyzer cargo comfy-table 7.2.2 style/presets/UTF8_FULL., *}; |
| 2 | |
| 3 | // This example works even with the `tty` feature disabled |
| 4 | // You can try it out with `cargo run --example no_tty --no-default-features` |
| 5 | |
| 6 | fn mainrust-analyzer cargo comfy-table 7.2.2 main().() { |
| 7 | let mut table = Tablerust-analyzer cargo comfy-table 7.2.2 table/Table#::newrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]new().(); |
| 8 | table.load_presetrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]load_preset().(UTF8_FULLrust-analyzer cargo comfy-table 7.2.2 style/presets/UTF8_FULL.) |
| 9 | .set_content_arrangementrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]set_content_arrangement().(ContentArrangementrust-analyzer cargo comfy-table 7.2.2 style/table/ContentArrangement#::Dynamicrust-analyzer cargo comfy-table 7.2.2 style/table/ContentArrangement#Dynamic#) |
| 10 | .set_widthrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]set_width().(80) |
| 11 | .set_headerrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]set_header().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 12 | Cellrust-analyzer cargo comfy-table 7.2.2 cell/Cell#::newrust-analyzer cargo comfy-table 7.2.2 cell/impl#[Cell]new().("Header1"), |
| 13 | Cellrust-analyzer cargo comfy-table 7.2.2 cell/Cell#::newrust-analyzer cargo comfy-table 7.2.2 cell/impl#[Cell]new().("Header2"), |
| 14 | Cellrust-analyzer cargo comfy-table 7.2.2 cell/Cell#::newrust-analyzer cargo comfy-table 7.2.2 cell/impl#[Cell]new().("Header3"), |
| 15 | ]) |
| 16 | .add_rowrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]add_row().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 17 | Cellrust-analyzer cargo comfy-table 7.2.2 cell/Cell#::newrust-analyzer cargo comfy-table 7.2.2 cell/impl#[Cell]new().("No bold text without tty"), |
| 18 | Cellrust-analyzer cargo comfy-table 7.2.2 cell/Cell#::newrust-analyzer cargo comfy-table 7.2.2 cell/impl#[Cell]new().("No colored text without tty"), |
| 19 | Cellrust-analyzer cargo comfy-table 7.2.2 cell/Cell#::newrust-analyzer cargo comfy-table 7.2.2 cell/impl#[Cell]new().("No custom background without tty"), |
| 20 | ]) |
| 21 | .add_rowrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]add_row().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 22 | Cellrust-analyzer cargo comfy-table 7.2.2 cell/Cell#::newrust-analyzer cargo comfy-table 7.2.2 cell/impl#[Cell]new().("Blinky boi"), |
| 23 | Cellrust-analyzer cargo comfy-table 7.2.2 cell/Cell#::newrust-analyzer cargo comfy-table 7.2.2 cell/impl#[Cell]new().("This table's content is dynamically arranged. The table is exactly 80 characters wide.\nHere comes a reallylongwordthatshoulddynamicallywrap"), |
| 24 | Cellrust-analyzer cargo comfy-table 7.2.2 cell/Cell#::newrust-analyzer cargo comfy-table 7.2.2 cell/impl#[Cell]new().("Done"), |
| 25 | ]); |
| 26 | |
| 27 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{table}"); |
| 28 | } |