text-tables

Crates.iotext-tables
lib.rstext-tables
version0.3.1
sourcesrc
created_at2018-02-27 12:03:24.470554
updated_at2019-03-03 11:54:38.618144
descriptionA terminal/text table prettifier with no dependencies
homepagehttps://github.com/derekdreery/text-table
repositoryhttps://github.com/derekdreery/text-table
max_upload_size
id53028
size7,579
Richard Dodd (derekdreery)

documentation

README

Text-tables

This library provides very simple table printing using text characters. It has no dependencies besides std. I'm interested in making it no_std if this is possible, contributions welcome!

Licensed under MIT or Apache-2.0 at your discretion. Message me if this isn't sufficient.

Example

extern crate text_tables;

use std::str;
use std::io;

fn main() {
    // can be vec or slices
    let data = [["A", "2x2"], ["pretty", "table"]];
    // we can either render to an array...
    let mut out = Vec::new();
    text_tables::render(&mut out, data).unwrap();
    println!("{}", str::from_utf8(&out).unwrap());
    // ...or we can use `Write` streams directly
    text_tables::render(&mut io::stdout(), data).unwrap();
}

outputs

+--------+-------+
| A      | 2x2   |
+--------+-------+
| pretty | table |
+--------+-------+
Commit count: 0

cargo fmt