From 72b40aece3db5f7f6ac832b777089a296a3f7fa3 Mon Sep 17 00:00:00 2001 From: Michael Aaron Murphy Date: Thu, 30 Apr 2026 21:36:24 +0200 Subject: [PATCH] perf: use `Box` with `tab::Item` to reduce message size by 800 bytes --- src/app.rs | 2 +- src/dialog.rs | 2 +- src/tab.rs | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app.rs b/src/app.rs index 7c0d127..40c9e5a 100644 --- a/src/app.rs +++ b/src/app.rs @@ -442,7 +442,7 @@ pub enum Message { TabRescan( Entity, Location, - Option, + Option>, Vec, Option>, ), diff --git a/src/dialog.rs b/src/dialog.rs index bca80ef..14b645a 100644 --- a/src/dialog.rs +++ b/src/dialog.rs @@ -475,7 +475,7 @@ enum Message { TabMessage(tab::Message), TabRescan( Location, - Option, + Option>, Vec, Option>, ), diff --git a/src/tab.rs b/src/tab.rs index b80aaf4..3fdd2fd 100644 --- a/src/tab.rs +++ b/src/tab.rs @@ -1538,7 +1538,7 @@ impl Location { } } - pub fn scan(&self, sizes: IconSizes) -> (Option, Vec) { + pub fn scan(&self, sizes: IconSizes) -> (Option>, Vec) { let items = match self { Self::Desktop(path, display, desktop_config) => { scan_desktop(path, display, *desktop_config, sizes) @@ -1554,7 +1554,7 @@ impl Location { }; let parent_item_opt = match self.path_opt() { Some(path) => match item_from_path(path, sizes) { - Ok(item) => Some(item), + Ok(item) => Some(Box::new(item)), Err(err) => { log::warn!("failed to get item for {}: {}", path.display(), err); None @@ -2637,7 +2637,7 @@ pub struct Tab { pub sort_name: HeadingOptions, pub sort_direction: bool, pub gallery: bool, - pub(crate) parent_item_opt: Option, + pub(crate) parent_item_opt: Option>, pub(crate) items_opt: Option>, pub dnd_hovered: Option<(Location, Instant)>, pub(crate) scrollable_id: widget::Id,