diff options
| author | 魏曹先生 <1992414357@qq.com> | 2025-10-27 17:59:19 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-27 17:59:19 +0800 |
| commit | 5e150adf0e3d8b3843779eddd83469d1b1ba84bc (patch) | |
| tree | aedbd6cd10757da9c9d401a818ed1471f377d54b /crates/system_action/src/action.rs | |
| parent | 49ad7a152cf849c8d91ee6b686da31f9c252f77c (diff) | |
| parent | 368687c943a13427b5338a30fb7b55558420f4de (diff) | |
Merge pull request #26 from JustEnoughVCS/jvcs_dev
Jvcs dev
Diffstat (limited to 'crates/system_action/src/action.rs')
| -rw-r--r-- | crates/system_action/src/action.rs | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/crates/system_action/src/action.rs b/crates/system_action/src/action.rs index 8a6180a..9eef1db 100644 --- a/crates/system_action/src/action.rs +++ b/crates/system_action/src/action.rs @@ -23,7 +23,10 @@ where #[derive(Default)] pub struct ActionContext { /// Whether the action is executed locally or remotely - local: bool, + proc_on_local: bool, + + /// Whether the action being executed in the current context is a remote action + is_remote_action: bool, /// The name of the action being executed action_name: String, @@ -42,7 +45,7 @@ impl ActionContext { /// Generate local context pub fn local() -> Self { ActionContext { - local: true, + proc_on_local: true, ..Default::default() } } @@ -50,7 +53,7 @@ impl ActionContext { /// Generate remote context pub fn remote() -> Self { ActionContext { - local: false, + proc_on_local: false, ..Default::default() } } @@ -75,13 +78,23 @@ impl ActionContext { impl ActionContext { /// Whether the action is executed locally - pub fn is_local(&self) -> bool { - self.local + pub fn is_proc_on_local(&self) -> bool { + self.proc_on_local } /// Whether the action is executed remotely - pub fn is_remote(&self) -> bool { - !self.local + pub fn is_proc_on_remote(&self) -> bool { + !self.proc_on_local + } + + /// Whether the action being executed in the current context is a remote action + pub fn is_remote_action(&self) -> bool { + self.is_remote_action + } + + /// Set whether the action being executed in the current context is a remote action + pub fn set_is_remote_action(&mut self, is_remote_action: bool) { + self.is_remote_action = is_remote_action; } /// Get the connection instance in the current context |
