From e3aeb6a1c9955eee2c396230317e63becd24ec6a Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Thu, 26 Feb 2026 00:51:45 +0800 Subject: Replace string type identifiers with TypeId for command output matching --- src/systems/cmd/macros.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/systems/cmd/macros.rs') diff --git a/src/systems/cmd/macros.rs b/src/systems/cmd/macros.rs index 23a277c..454ad30 100644 --- a/src/systems/cmd/macros.rs +++ b/src/systems/cmd/macros.rs @@ -12,6 +12,7 @@ /// Then paste the following content into your code /// /// ```ignore +/// use std::any::TypeId; /// use cmd_system_macros::exec; /// use crate::{ /// cmd_output, @@ -71,7 +72,7 @@ /// async fn exec( /// input: In, /// collect: Collect, -/// ) -> Result<(Box, String), CmdExecuteError> { +/// ) -> Result<(Box, TypeId), CmdExecuteError> { /// todo!(); /// /// // Use the following method to return results @@ -82,6 +83,7 @@ /// Of course, you can also use the comment-free version /// /// ```ignore +/// use std::any::TypeId; /// use cmd_system_macros::exec; /// use crate::{ /// cmd_output, @@ -115,7 +117,7 @@ /// async fn exec( /// input: In, /// collect: Collect, -/// ) -> Result<(Box, String), CmdExecuteError> { +/// ) -> Result<(Box, TypeId), CmdExecuteError> { /// todo!(); /// cmd_output!(output, JVCustomOutput) /// } @@ -145,7 +147,7 @@ macro_rules! command_template { input: In, collect: Collect, ) -> Result< - (Box, String), + (Box, std::any::TypeId), $crate::systems::cmd::errors::CmdExecuteError, > { exec(input, collect).await @@ -163,7 +165,7 @@ macro_rules! cmd_output { ($v:expr, $t:ty) => { Ok(( Box::new($v) as Box, - stringify!($t).to_string(), + std::any::TypeId::of::<$t>(), )) }; } -- cgit