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 --- templates/_specific_renderer_matching.rs.template | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'templates/_specific_renderer_matching.rs.template') diff --git a/templates/_specific_renderer_matching.rs.template b/templates/_specific_renderer_matching.rs.template index 9b3765f..4f1c7d2 100644 --- a/templates/_specific_renderer_matching.rs.template +++ b/templates/_specific_renderer_matching.rs.template @@ -1,14 +1,12 @@ -match type_name_str { +// Auto generated by build.rs +match type_id { // MATCHING // -- TEMPLATE START -- - "OutputTypeName" => { + type_id if type_id == std::any::TypeId::of::() => { RendererType::render( - &data - .downcast::() - .unwrap(), - ) - .await - } + &data.downcast::() + .unwrap()).await + }, // -- TEMPLATE END -- - _ => Err(CmdRenderError::RendererNotFound(type_name)), + _ => Err(CmdRenderError::RendererNotFound(format!("{:?}", type_id))) } -- cgit