aboutsummaryrefslogtreecommitdiff
path: root/mingling_core/src/renderer/structural/structural_data.rs
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-07-21 05:49:00 +0800
committer魏曹先生 <1992414357@qq.com>2026-07-21 05:49:00 +0800
commit700c049f64b66f424cda5da3021dfce4462655ca (patch)
treeb4fd21e5e6f82be29b18c47d8617814b28c159a6 /mingling_core/src/renderer/structural/structural_data.rs
parent2097238b57810d78989d3ecab8bc97ce1b8a6aa1 (diff)
feat(core): add generic parameter `C` to `StructuralData` trait
Make `StructuralData` and `StructuralDataSealed` generic over a program collector type to bypass the orphan rule for `group_structural!`. This enables external types to implement `StructuralData<crate::ThisProgram>` without violating coherence.
Diffstat (limited to 'mingling_core/src/renderer/structural/structural_data.rs')
-rw-r--r--mingling_core/src/renderer/structural/structural_data.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/mingling_core/src/renderer/structural/structural_data.rs b/mingling_core/src/renderer/structural/structural_data.rs
index 1cafac3..583808c 100644
--- a/mingling_core/src/renderer/structural/structural_data.rs
+++ b/mingling_core/src/renderer/structural/structural_data.rs
@@ -1,5 +1,7 @@
use serde::Serialize;
+use crate::ProgramCollect;
+
/// Marker trait for types that support structured output (JSON / YAML / TOML / RON).
///
/// This trait is a **supertrait** of `serde::Serialize` and is sealed via
@@ -12,4 +14,8 @@ use serde::Serialize;
/// These entry points also register the type in the global `STRUCTURED_TYPES`
/// registry, which is required for the `structural_render` match arm to be generated.
#[doc(hidden)]
-pub trait StructuralData: Serialize + crate::__private::StructuralDataSealed {}
+pub trait StructuralData<C>: Serialize + crate::__private::StructuralDataSealed<C>
+where
+ C: ProgramCollect<Enum = C>,
+{
+}