diff options
| author | Daniel Jankowski <daniel.jankowski@rub.de> | 2023-12-17 14:33:32 +0100 |
|---|---|---|
| committer | Daniel Jankowski <daniel.jankowski@rub.de> | 2023-12-17 14:33:32 +0100 |
| commit | aa67d6fbecab9a45b6044f019adb303bc84d63fe (patch) | |
| tree | b29760b80a67a44d274c62936b41c3ccc484c95d /src/frames.rs | |
| parent | feat: perf + mem optimization of rendering (diff) | |
| download | sl0pstatus-aa67d6fbecab9a45b6044f019adb303bc84d63fe.tar.gz sl0pstatus-aa67d6fbecab9a45b6044f019adb303bc84d63fe.tar.xz sl0pstatus-aa67d6fbecab9a45b6044f019adb303bc84d63fe.zip | |
feat: further perf + mem optimization of widgets
Diffstat (limited to 'src/frames.rs')
| -rw-r--r-- | src/frames.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/frames.rs b/src/frames.rs index dc3d30d..d43a0e4 100644 --- a/src/frames.rs +++ b/src/frames.rs @@ -5,7 +5,7 @@ pub fn hide_frames_on_single_pane( pane_info: PaneManifest, plugin_pane_id: PluginIds, ) { - let panes = match get_current_panes(tabs, pane_info) { + let panes = match get_current_panes(&tabs, &pane_info) { Some(panes) => panes, None => return, }; @@ -13,7 +13,7 @@ pub fn hide_frames_on_single_pane( // check if we are running for the current tab since one plugin will run for // each tab. If we do not prevent execution, the screen will start to flicker // 'cause every plugin will try to toggle the frames - if !is_plugin_for_current_tab(panes.clone(), plugin_pane_id) { + if !is_plugin_for_current_tab(&panes, plugin_pane_id) { return; } @@ -37,7 +37,7 @@ pub fn hide_frames_on_single_pane( } } -fn is_plugin_for_current_tab(panes: Vec<PaneInfo>, plugin_pane_id: PluginIds) -> bool { +fn is_plugin_for_current_tab(panes: &[PaneInfo], plugin_pane_id: PluginIds) -> bool { let plugin_pane = panes .iter() .find(|p| p.is_plugin && p.id == plugin_pane_id.plugin_id); @@ -45,12 +45,12 @@ fn is_plugin_for_current_tab(panes: Vec<PaneInfo>, plugin_pane_id: PluginIds) -> plugin_pane.is_some() } -fn get_current_panes(tabs: Vec<TabInfo>, pane_info: PaneManifest) -> Option<Vec<PaneInfo>> { +fn get_current_panes(tabs: &[TabInfo], pane_info: &PaneManifest) -> Option<Vec<PaneInfo>> { let active_tab = tabs.iter().find(|t| t.active); let active_tab = active_tab.as_ref()?; pane_info .panes .get(&active_tab.position) - .map(|p| (*p).clone()) + .cloned() } |
