From e076b120293995fe4a7c944ce899a2903e31b9bf Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Sun, 12 Oct 2025 18:15:44 +0800 Subject: fix: Resolve callback type mismatch in client_registry - Fix lifetime issue in on_proc_begin callback registration - Use cloned context in async closure to avoid lifetime conflicts - Rename unused variable to suppress warning --- crates/vcs_actions/src/registry/client_registry.rs | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'crates/vcs_actions/src/registry') diff --git a/crates/vcs_actions/src/registry/client_registry.rs b/crates/vcs_actions/src/registry/client_registry.rs index e69de29..c32ce5a 100644 --- a/crates/vcs_actions/src/registry/client_registry.rs +++ b/crates/vcs_actions/src/registry/client_registry.rs @@ -0,0 +1,39 @@ +use action_system::{action::ActionContext, action_pool::ActionPool}; +use tcp_connection::error::TcpTargetError; + +use crate::actions::local_actions::SetUpstreamVaultAction; + +fn register_actions(pool: &mut ActionPool) { + // Pool register here + SetUpstreamVaultAction::register_to_pool(pool); +} + +pub fn client_action_pool() -> ActionPool { + // Create pool + let mut pool = ActionPool::new(); + + // Register actions + register_actions(&mut pool); + + // Add process events + pool.set_on_proc_begin(|ctx| Box::pin(on_proc_begin(ctx))); + + // Return + pool +} + +async fn on_proc_begin(ctx: &ActionContext) -> Result<(), TcpTargetError> { + // Get instance + let Some(_instance) = ctx.instance() else { + return Err(TcpTargetError::Unsupported( + "Missing ConnectionInstance in current context, this ActionPool does not support this call" + .to_string())); + }; + + // If it's remote, invoke action at server + if ctx.is_remote() { + // instance.write_text(text) + } + + Ok(()) +} -- cgit