aboutsummaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorDaniel Jankowski <daniel.jankowski@rub.de>2023-12-17 15:56:40 +0100
committerDaniel Jankowski <daniel.jankowski@rub.de>2023-12-17 15:56:40 +0100
commit19b8d9d63c55ade8b1a2fc70732756ae161909b4 (patch)
tree3d60c361b89a46ca2f8959217e1298d7a288aebb /src/widgets
parentfeat: add bench for render_bar (diff)
downloadsl0pstatus-19b8d9d63c55ade8b1a2fc70732756ae161909b4.tar.gz
sl0pstatus-19b8d9d63c55ade8b1a2fc70732756ae161909b4.tar.xz
sl0pstatus-19b8d9d63c55ade8b1a2fc70732756ae161909b4.zip
chore: ref config instead of copying
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/command.rs4
-rw-r--r--src/widgets/datetime.rs2
-rw-r--r--src/widgets/mode.rs2
-rw-r--r--src/widgets/session.rs2
-rw-r--r--src/widgets/swap_layout.rs2
-rw-r--r--src/widgets/tabs.rs2
6 files changed, 7 insertions, 7 deletions
diff --git a/src/widgets/command.rs b/src/widgets/command.rs
index c7df9b7..17c5e22 100644
--- a/src/widgets/command.rs
+++ b/src/widgets/command.rs
@@ -40,7 +40,7 @@ pub struct CommandWidget {
}
impl CommandWidget {
- pub fn new(config: BTreeMap<String, String>) -> Self {
+ pub fn new(config: &BTreeMap<String, String>) -> Self {
Self {
config: parse_config(config),
}
@@ -119,7 +119,7 @@ fn run_command_if_needed(command_config: CommandConfig, name: &str, state: &Zell
}
}
-fn parse_config(zj_conf: BTreeMap<String, String>) -> BTreeMap<String, CommandConfig> {
+fn parse_config(zj_conf: &BTreeMap<String, String>) -> BTreeMap<String, CommandConfig> {
let mut keys: Vec<String> = zj_conf
.keys()
.filter(|k| k.starts_with("command_"))
diff --git a/src/widgets/datetime.rs b/src/widgets/datetime.rs
index ef2fbee..e846d34 100644
--- a/src/widgets/datetime.rs
+++ b/src/widgets/datetime.rs
@@ -14,7 +14,7 @@ pub struct DateTimeWidget {
}
impl DateTimeWidget {
- pub fn new(config: BTreeMap<String, String>) -> Self {
+ pub fn new(config: &BTreeMap<String, String>) -> Self {
let mut format = "%H:%M";
if let Some(form) = config.get("datetime_format") {
format = form;
diff --git a/src/widgets/mode.rs b/src/widgets/mode.rs
index 0cd68ac..db73544 100644
--- a/src/widgets/mode.rs
+++ b/src/widgets/mode.rs
@@ -25,7 +25,7 @@ pub struct ModeWidget {
}
impl ModeWidget {
- pub fn new(config: BTreeMap<String, String>) -> Self {
+ pub fn new(config: &BTreeMap<String, String>) -> Self {
let normal_format = match config.get("mode_normal") {
Some(form) => FormattedPart::multiple_from_format_string(form.to_owned()),
None => vec![],
diff --git a/src/widgets/session.rs b/src/widgets/session.rs
index 4d2ebf0..4916a65 100644
--- a/src/widgets/session.rs
+++ b/src/widgets/session.rs
@@ -5,7 +5,7 @@ use crate::{config::ZellijState, widgets::widget::Widget};
pub struct SessionWidget {}
impl SessionWidget {
- pub fn new(_config: BTreeMap<String, String>) -> Self {
+ pub fn new(_config: &BTreeMap<String, String>) -> Self {
Self {}
}
}
diff --git a/src/widgets/swap_layout.rs b/src/widgets/swap_layout.rs
index 9b4dda6..f744e38 100644
--- a/src/widgets/swap_layout.rs
+++ b/src/widgets/swap_layout.rs
@@ -6,7 +6,7 @@ use crate::{config::ZellijState, widgets::widget::Widget};
pub struct SwapLayoutWidget {}
impl SwapLayoutWidget {
- pub fn new(_config: BTreeMap<String, String>) -> Self {
+ pub fn new(_config: &BTreeMap<String, String>) -> Self {
Self {}
}
}
diff --git a/src/widgets/tabs.rs b/src/widgets/tabs.rs
index cefd124..d8a292d 100644
--- a/src/widgets/tabs.rs
+++ b/src/widgets/tabs.rs
@@ -16,7 +16,7 @@ pub struct TabsWidget {
}
impl TabsWidget {
- pub fn new(config: BTreeMap<String, String>) -> Self {
+ pub fn new(config: &BTreeMap<String, String>) -> Self {
let mut normal_tab_format: Vec<FormattedPart> = Vec::new();
if let Some(form) = config.get("tab_normal") {
normal_tab_format = FormattedPart::multiple_from_format_string(form.to_owned());