1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-07-30 18:38:27 +00:00

perf(core): wrap AddressDetails in a GcBox

[no changelog]
This commit is contained in:
Roman Zeyde 2025-04-23 11:30:19 +03:00
parent a0ab4963f0
commit 5c49084a16
2 changed files with 8 additions and 8 deletions

View File

@ -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<TString<'static>>,
path: Option<TString<'static>>,
) -> Result<Self, Error> {
) -> Result<GcBox<Self>, Error> {
let mut para = ParagraphVecShort::new();
if let Some(a) = account {
para.add(Paragraph::new::<TString>(
@ -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<AddressDetails> {
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<AddressDetails> {
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<AddressDetails> {
fn trace(&self, t: &mut dyn crate::trace::Tracer) {
t.component("AddressDetails");
match self.current_page {

View File

@ -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<AddressDetails> {
fn msg_try_into_obj(&self, _msg: Self::Msg) -> Result<Obj, Error> {
Ok(CANCELLED.as_obj())
}