From 5c49084a166c2d87f3c024409ecdc1bc4e76e746 Mon Sep 17 00:00:00 2001 From: Roman Zeyde Date: Wed, 23 Apr 2025 11:30:19 +0300 Subject: [PATCH] perf(core): wrap `AddressDetails` in a `GcBox` [no changelog] --- .../ui/layout_delizia/component/address_details.rs | 12 ++++++------ .../rust/src/ui/layout_delizia/component_msg_obj.rs | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/core/embed/rust/src/ui/layout_delizia/component/address_details.rs b/core/embed/rust/src/ui/layout_delizia/component/address_details.rs index 62c213a34b..caf21a5abe 100644 --- a/core/embed/rust/src/ui/layout_delizia/component/address_details.rs +++ b/core/embed/rust/src/ui/layout_delizia/component/address_details.rs @@ -2,7 +2,7 @@ use heapless::Vec; use crate::{ error::Error, - micropython::buffer::StrBuffer, + micropython::{buffer::StrBuffer, gc::GcBox}, strutil::TString, translations::TR, ui::{ @@ -36,7 +36,7 @@ impl AddressDetails { details_title: TString<'static>, account: Option>, path: Option>, - ) -> Result { + ) -> Result, Error> { let mut para = ParagraphVecShort::new(); if let Some(a) = account { para.add(Paragraph::new::( @@ -73,7 +73,7 @@ impl AddressDetails { xpub_page_count: Vec::new(), current_page: 0, }; - Ok(result) + GcBox::new(result) } pub fn add_xpub(&mut self, title: StrBuffer, xpub: StrBuffer) -> Result<(), Error> { @@ -128,7 +128,7 @@ impl PaginateFull for AddressDetails { } } -impl Component for AddressDetails { +impl Component for GcBox { type Msg = (); fn place(&mut self, bounds: Rect) -> Rect { @@ -176,7 +176,7 @@ impl Component for AddressDetails { } } -impl Swipable for AddressDetails { +impl Swipable for GcBox { fn get_swipe_config(&self) -> SwipeConfig { match self.current_page { 0 => self.details.get_swipe_config(), @@ -190,7 +190,7 @@ impl Swipable for AddressDetails { } #[cfg(feature = "ui_debug")] -impl crate::trace::Trace for AddressDetails { +impl crate::trace::Trace for GcBox { fn trace(&self, t: &mut dyn crate::trace::Tracer) { t.component("AddressDetails"); match self.current_page { diff --git a/core/embed/rust/src/ui/layout_delizia/component_msg_obj.rs b/core/embed/rust/src/ui/layout_delizia/component_msg_obj.rs index 7422ec7d69..03269150ef 100644 --- a/core/embed/rust/src/ui/layout_delizia/component_msg_obj.rs +++ b/core/embed/rust/src/ui/layout_delizia/component_msg_obj.rs @@ -8,7 +8,7 @@ use super::component::{ }; use crate::{ error::Error, - micropython::obj::Obj, + micropython::{gc::GcBox, obj::Obj}, ui::{ component::{paginated::PaginateFull, Component, Never}, flow::Swipable, @@ -174,7 +174,7 @@ where } } -impl ComponentMsgObj for AddressDetails { +impl ComponentMsgObj for GcBox { fn msg_try_into_obj(&self, _msg: Self::Msg) -> Result { Ok(CANCELLED.as_obj()) }