From a747b03c17a74c116bcda70467ebb4cc2270eb86 Mon Sep 17 00:00:00 2001 From: Chris Glass Date: Fri, 10 Apr 2026 19:00:25 +0200 Subject: [PATCH] Bonus: reduce size of Message further Turns out we can reduce the size of Message even further by also boxing the Config variant. The size of the Message enum has now dropped from 900+ bytes to 64 bytes. --- src/main.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index 3e815a1..fbcda25 100644 --- a/src/main.rs +++ b/src/main.rs @@ -363,7 +363,7 @@ pub enum Message { ColorSchemeRename(ColorSchemeKind, ColorSchemeId, String), ColorSchemeRenameSubmit, ColorSchemeTabActivate(widget::segmented_button::Entity), - Config(Config), + Config(Box), Copy(Option), CopyOrSigint(Option), CopyPrimary(Option), @@ -2128,11 +2128,11 @@ impl Application for App { } } Message::Config(config) => { - if config != self.config { + if *config != self.config { let shortcuts_changed = config.shortcuts_custom != self.config.shortcuts_custom; log::info!("update config"); //TODO: update syntax theme by clearing tabs, only if needed - self.config = config; + self.config = *config; if shortcuts_changed { self.shortcuts_config = shortcuts::ShortcutsConfig::new(self.config.shortcuts_custom.clone()); @@ -3596,7 +3596,7 @@ impl Application for App { update.errors ); } - Message::Config(update.config) + Message::Config(Box::new(update.config)) }), match &self.dialog_opt { Some(dialog) => dialog.subscription(),