From 0a077ae797915eb2337c6565bb7338e5efa26637 Mon Sep 17 00:00:00 2001 From: kernelkind Date: Tue, 15 Oct 2024 11:45:13 -0400 Subject: [PATCH] fix unnecessary copy every frame Signed-off-by: kernelkind --- src/nav.rs | 2 +- src/timeline/route.rs | 2 +- src/ui/profile/mod.rs | 4 ++-- src/ui/thread.rs | 7 +++++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/nav.rs b/src/nav.rs index a3e62a3..4f6d395 100644 --- a/src/nav.rs +++ b/src/nav.rs @@ -117,7 +117,7 @@ pub fn render_nav(col: usize, app: &mut Damus, ui: &mut egui::Ui) { } Route::Profile(pubkey) => render_profile_route( - *pubkey, + pubkey, &app.ndb, &mut app.columns, &mut app.profiles, diff --git a/src/timeline/route.rs b/src/timeline/route.rs index 3a5597c..073479c 100644 --- a/src/timeline/route.rs +++ b/src/timeline/route.rs @@ -157,7 +157,7 @@ pub fn render_timeline_route( #[allow(clippy::too_many_arguments)] pub fn render_profile_route( - pubkey: Pubkey, + pubkey: &Pubkey, ndb: &Ndb, columns: &mut Columns, profiles: &mut NotesHolderStorage, diff --git a/src/ui/profile/mod.rs b/src/ui/profile/mod.rs index 7a87402..8c9b08e 100644 --- a/src/ui/profile/mod.rs +++ b/src/ui/profile/mod.rs @@ -15,7 +15,7 @@ use crate::{ use super::timeline::{tabs_ui, TimelineTabView}; pub struct ProfileView<'a> { - pubkey: Pubkey, + pubkey: &'a Pubkey, col_id: usize, profiles: &'a mut NotesHolderStorage, ndb: &'a Ndb, @@ -25,7 +25,7 @@ pub struct ProfileView<'a> { impl<'a> ProfileView<'a> { pub fn new( - pubkey: Pubkey, + pubkey: &'a Pubkey, col_id: usize, profiles: &'a mut NotesHolderStorage, ndb: &'a Ndb, diff --git a/src/ui/thread.rs b/src/ui/thread.rs index 38a724b..ee568e8 100644 --- a/src/ui/thread.rs +++ b/src/ui/thread.rs @@ -1,6 +1,9 @@ use crate::{ - actionbar::TimelineResponse, imgcache::ImageCache, notecache::NoteCache, - notes_holder::{NotesHolder, NotesHolderStorage}, thread::Thread, + actionbar::TimelineResponse, + imgcache::ImageCache, + notecache::NoteCache, + notes_holder::{NotesHolder, NotesHolderStorage}, + thread::Thread, }; use nostrdb::{Ndb, NoteKey, Transaction}; use tracing::error;