save game

This commit is contained in:
Gerrit Viljoen 2020-05-16 21:56:52 +02:00
parent 1f5dab68d2
commit d930d332d0
2 changed files with 5 additions and 2 deletions

View File

@ -13,5 +13,8 @@ readme = "readme.md"
categories = ["command-line-interface"]
keywords = ["ascii", "table"]
[dependencies]
regex = "1"
[dev-dependencies]
colorful = "0.2"

View File

@ -225,14 +225,14 @@ impl AsciiTable {
let result: Vec<_> = (0..num_cols).map(|a| {
let default_conf = &DEFAULT_COLUMN;
let conf = self.columns.get(&a).unwrap_or(default_conf);
let column_width = data.iter().map(|row| Self::count_characters(&row[a])).max().unwrap();
let column_width = data.iter().map(|row| self.count_characters(&row[a])).max().unwrap();
let header_width = conf.header.chars().count();
column_width.max(header_width).min(conf.max_width)
}).collect();
self.truncate_widths(result)
}
fn count_characters(cell: &str) -> usize {
fn count_characters(&self, cell: &str) -> usize {
cell.chars().count()
}