diff options
| author | Daniel Jankowski <daniel.jankowski@rub.de> | 2023-12-17 13:46:19 +0100 |
|---|---|---|
| committer | Daniel Jankowski <daniel.jankowski@rub.de> | 2023-12-17 13:46:19 +0100 |
| commit | f51455d02e14c447fe174b2ae4869c24e83349d4 (patch) | |
| tree | f441f8f2181fceab62975041b6b5b4f102e8f174 /src/widgets/command.rs | |
| parent | feat: add more benches for widgets (diff) | |
| download | sl0pstatus-f51455d02e14c447fe174b2ae4869c24e83349d4.tar.gz sl0pstatus-f51455d02e14c447fe174b2ae4869c24e83349d4.tar.xz sl0pstatus-f51455d02e14c447fe174b2ae4869c24e83349d4.zip | |
feat: perf + mem optimization of rendering
Diffstat (limited to 'src/widgets/command.rs')
| -rw-r--r-- | src/widgets/command.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/widgets/command.rs b/src/widgets/command.rs index ea6a6fc..8a7a3f8 100644 --- a/src/widgets/command.rs +++ b/src/widgets/command.rs @@ -43,7 +43,7 @@ impl CommandWidget { } impl Widget for CommandWidget { - fn process(&self, name: &str, state: ZellijState) -> String { + fn process(&self, name: &str, state: &ZellijState) -> String { let command_config = match self.config.get(name) { Some(cc) => cc, None => { @@ -51,7 +51,7 @@ impl Widget for CommandWidget { } }; - run_command_if_needed(command_config.clone(), name, state.clone()); + run_command_if_needed(command_config.clone(), name, state); let command_result = match state.command_results.get(name) { Some(cr) => cr, @@ -89,13 +89,13 @@ impl Widget for CommandWidget { ); } - command_config.format.format_string(content) + command_config.format.format_string(&content) } - fn process_click(&self, _state: ZellijState, _pos: usize) {} + fn process_click(&self, _state: &ZellijState, _pos: usize) {} } -fn run_command_if_needed(command_config: CommandConfig, name: &str, state: ZellijState) { +fn run_command_if_needed(command_config: CommandConfig, name: &str, state: &ZellijState) { let ts = Local::now(); let last_run = get_timestamp_from_event_or_default(name, state.clone(), command_config.interval); |
