summaryrefslogtreecommitdiffstats
path: root/src/column.rs
diff options
context:
space:
mode:
authorBen S <ogham@bsago.me>2015-06-28 19:57:13 +0100
committerBen S <ogham@bsago.me>2015-06-28 19:57:13 +0100
commit922cd2a1886d7c03d47d77ba87d5bfb0e5cb18fb (patch)
tree3ad921097e4433ab15de9e43ca9cc814d58ed95c /src/column.rs
parent89526964c99446919f3784bd3a74fd03a441a8b1 (diff)
Cache the rendered cells
Previously, each time it tried to render a table (to check its width), it both re-queried the filesystem and re-formatted the values into coloured strings. These values are now calculated only once before the table is drawn, and are used repeatedly throughout. Although it looks as though there's more `clone()`ing going on than before, it used to be recalculating things and storing them as vectors anyway, so the memory would still be used in any case.
Diffstat (limited to 'src/column.rs')
-rw-r--r--src/column.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/column.rs b/src/column.rs
index 6f4a1e7..0da3651 100644
--- a/src/column.rs
+++ b/src/column.rs
@@ -57,7 +57,7 @@ impl Column {
}
-#[derive(PartialEq, Debug)]
+#[derive(PartialEq, Debug, Clone)]
pub struct Cell {
pub length: usize,
pub text: String,