Crates.io | verynicetable |
lib.rs | verynicetable |
version | 0.5.0 |
source | src |
created_at | 2024-08-28 18:53:43.761172 |
updated_at | 2024-09-29 12:32:50.645002 |
description | Number one table. |
homepage | |
repository | https://github.com/qrichert/verynicetable.git |
max_upload_size | |
id | 1355037 |
size | 46,212 |
Number one table.
Very basic and lightweight table builder to print tabular data.
use std::fmt::Alignment::{Left, Right};
use verynicetable::Table;
fn main() {
let ports = vec![
vec!["rapportd", "449", "Quentin", "*:61165"],
vec!["Python", "22396", "Quentin", "*:8000"],
vec!["foo", "108", "root", "*:1337"],
vec!["rustrover", "30928", "Quentin", "127.0.0.1:63342"],
vec!["Transmiss", "94671", "Quentin", "*:51413"],
vec!["Transmiss", "94671", "Quentin", "*:51413"],
];
let table = Table::new()
.headers(&["COMMAND", "PID", "USER", "HOST:PORTS"])
.alignments(&[Left, Right, Left, Right])
.data(&ports)
.max_rows(5)
.to_string();
print!("{table}");
}
COMMAND PID USER HOST:PORTS
rapportd 449 Quentin *:61165
Python 22396 Quentin *:8000
... ... ... ...
rustrover 30928 Quentin 127.0.0.1:63342
Transmiss 94671 Quentin *:51413
Transmiss 94671 Quentin *:51413
That's about it.