From bc2a5bad92be9012e2ef1d1e734407d890bc17f5 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Thu, 2 Nov 2023 11:55:13 +0100 Subject: [PATCH] rename widest_cell_length to widest_cell_width --- src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 394f7c3..1320b0e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -125,7 +125,7 @@ impl Dimensions { pub struct Grid { options: GridOptions, cells: Vec, - widest_cell_length: usize, + widest_cell_width: usize, dimensions: Dimensions, } @@ -134,13 +134,13 @@ impl Grid { /// Creates a new grid view with the given cells and options pub fn new>(cells: Vec, options: GridOptions) -> Self { let cells: Vec = cells.into_iter().map(Into::into).collect(); - let widest_cell_length = cells.iter().map(|c| c.width).max().unwrap_or(0); + let widest_cell_width = cells.iter().map(|c| c.width).max().unwrap_or(0); let width = options.width; let mut grid = Self { options, cells, - widest_cell_length, + widest_cell_width, dimensions: Dimensions { num_lines: 0, widths: Vec::new(), @@ -215,7 +215,7 @@ impl Grid { } fn width_dimensions(&self, maximum_width: usize) -> Option { - if self.widest_cell_length > maximum_width { + if self.widest_cell_width > maximum_width { // Largest cell is wider than maximum width; it is impossible to fit. return None; } @@ -293,7 +293,7 @@ impl fmt::Display for Grid { // We overestimate how many spaces we need, but this is not // part of the loop and it's therefore not super important to // get exactly right. - let padding = " ".repeat(self.widest_cell_length); + let padding = " ".repeat(self.widest_cell_width); for y in 0..self.dimensions.num_lines { for x in 0..self.dimensions.widths.len() {