diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-02-26 00:51:45 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-02-26 01:02:42 +0800 |
| commit | e3aeb6a1c9955eee2c396230317e63becd24ec6a (patch) | |
| tree | 5c70b2a73fb32ed1a717463c81a99e346d3c25e6 /templates/_specific_renderer_matching.rs.template | |
| parent | ae06e0b30a328508f48c108fabcccdf1d23c5643 (diff) | |
Replace string type identifiers with TypeId for command output matching
Diffstat (limited to 'templates/_specific_renderer_matching.rs.template')
| -rw-r--r-- | templates/_specific_renderer_matching.rs.template | 16 |
1 files changed, 7 insertions, 9 deletions
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::<OutputType>() => { RendererType::render( - &data - .downcast::<OutputType>() - .unwrap(), - ) - .await - } + &data.downcast::<OutputType>() + .unwrap()).await + }, // -- TEMPLATE END -- - _ => Err(CmdRenderError::RendererNotFound(type_name)), + _ => Err(CmdRenderError::RendererNotFound(format!("{:?}", type_id))) } |
