aboutsummaryrefslogtreecommitdiff
path: root/mingling_macros/src/renderer.rs
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-06-26 06:08:12 +0800
committer魏曹先生 <1992414357@qq.com>2026-06-26 06:08:12 +0800
commite735671acb3a81e1b7e334e56b9ef3963ba0c2fc (patch)
tree46562d6630bb1582b41b6741a7a4f482febf84da /mingling_macros/src/renderer.rs
parent473cd8e575d03d8bd5439e81cb6835f56a1e964f (diff)
feat(core): decouple structured output from Groupped trait
Introduce `StructuralData` sealed trait and `pack_structural!` / `group_structural!` / `derive(StructuralData)` macros to control structured rendering separately from grouping. `Groupped` no longer requires `Serialize`.
Diffstat (limited to 'mingling_macros/src/renderer.rs')
-rw-r--r--mingling_macros/src/renderer.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/mingling_macros/src/renderer.rs b/mingling_macros/src/renderer.rs
index a82744a..6de3d59 100644
--- a/mingling_macros/src/renderer.rs
+++ b/mingling_macros/src/renderer.rs
@@ -270,8 +270,17 @@ pub fn register_renderer(input: TokenStream) -> TokenStream {
renderers.insert(renderer_entry_str);
renderer_exist.insert(renderer_exist_entry_str);
+ // Only register general renderer if the type is in STRUCTURED_TYPES
#[cfg(feature = "general_renderer")]
- general_renderers.insert(general_renderer_entry_str);
+ {
+ let is_structured = get_global_set(&crate::STRUCTURED_TYPES)
+ .lock()
+ .unwrap()
+ .contains(&variant_name);
+ if is_structured {
+ general_renderers.insert(general_renderer_entry_str);
+ }
+ }
quote! {}.into()
}