papergrid 0.5.1

Papergrid is a core library to print a table
Documentation

Papergrid is a library for generating text-based tables for display

Example

use papergrid::{Grid, Entity, Borders, Settings};

let mut grid = Grid::new(2, 2);
grid.set_borders(Borders {
top: Some('-'),
top_left: Some('+'),
top_right: Some('+'),
top_intersection: Some('+'),
bottom: Some('-'),
bottom_left: Some('+'),
bottom_right: Some('+'),
bottom_intersection: Some('+'),
horizontal: Some('-'),
horizontal_left: Some('+'),
horizontal_right: Some('+'),
vertical_left: Some('|'),
vertical_right: Some('|'),
vertical_intersection: Some('|'),
intersection: Some('+'),
});

grid.set(Entity::Cell(0, 0), Settings::new().text("0-0"));
grid.set(Entity::Cell(0, 1), Settings::new().text("0-1"));
grid.set(Entity::Cell(1, 0), Settings::new().text("1-0"));
grid.set(Entity::Cell(1, 1), Settings::new().text("1-1"));

assert_eq!(
grid.to_string(),
concat!(
"+---+---+\n",
"|0-0|0-1|\n",
"+---+---+\n",
"|1-0|1-1|\n",
"+---+---+",
)
);