From d37359f34da0124efa30615c051a05e7cb69c211 Mon Sep 17 00:00:00 2001 From: Jasper Bekkers Date: Wed, 21 Feb 2024 16:36:19 +0100 Subject: [PATCH 1/2] Add tool display total amount of bytes under selection --- src/visualizer/allocation_reports.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/visualizer/allocation_reports.rs b/src/visualizer/allocation_reports.rs index a57f212..14a95c3 100644 --- a/src/visualizer/allocation_reports.rs +++ b/src/visualizer/allocation_reports.rs @@ -37,9 +37,13 @@ pub(crate) fn render_allocation_reports_ui( .enumerate() .filter(|(_, report)| report.name.to_lowercase().contains(&breakdown_filter)) .collect::>(); + let total_size_under_filter: u64 = allocations.iter().map(|a| a.1.size).sum(); - let row_height = ui.text_style_height(&egui::TextStyle::Body); + ui.horizontal(|ui| { + ui.label(format!("Total: {}", fmt_bytes(total_size_under_filter))); + }); + let row_height = ui.text_style_height(&egui::TextStyle::Body); let table = TableBuilder::new(ui) .striped(true) .resizable(true) From 31e326c08070d5575eb08cdfdc7a4dab188a7403 Mon Sep 17 00:00:00 2001 From: Jasper Bekkers Date: Fri, 1 Mar 2024 16:04:25 +0100 Subject: [PATCH 2/2] Address nit --- src/visualizer/allocation_reports.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/visualizer/allocation_reports.rs b/src/visualizer/allocation_reports.rs index 14a95c3..2e46f01 100644 --- a/src/visualizer/allocation_reports.rs +++ b/src/visualizer/allocation_reports.rs @@ -39,9 +39,7 @@ pub(crate) fn render_allocation_reports_ui( .collect::>(); let total_size_under_filter: u64 = allocations.iter().map(|a| a.1.size).sum(); - ui.horizontal(|ui| { - ui.label(format!("Total: {}", fmt_bytes(total_size_under_filter))); - }); + ui.label(format!("Total: {}", fmt_bytes(total_size_under_filter))); let row_height = ui.text_style_height(&egui::TextStyle::Body); let table = TableBuilder::new(ui)