From b2837ff3bea286ce7ccfba9b6fbcd861977caf83 Mon Sep 17 00:00:00 2001 From: Gokul Soumya Date: Sat, 24 Dec 2022 16:51:38 +0530 Subject: Minimize allocation when converting table rows to string --- helix-tui/src/widgets/table.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'helix-tui/src/widgets/table.rs') diff --git a/helix-tui/src/widgets/table.rs b/helix-tui/src/widgets/table.rs index 539f6a61..2983072d 100644 --- a/helix-tui/src/widgets/table.rs +++ b/helix-tui/src/widgets/table.rs @@ -122,11 +122,8 @@ impl<'a> Row<'a> { } /// Returns the contents of cells as plain text, without styles and colors. - pub fn cell_text(&self) -> Vec { - self.cells - .iter() - .map(|cell| String::from(&cell.content)) - .collect() + pub fn cell_text(&self) -> impl Iterator + '_ { + self.cells.iter().map(|cell| String::from(&cell.content)) } } -- cgit v1.2.3-70-g09d2