diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-07-21 05:49:00 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-07-21 05:49:00 +0800 |
| commit | 700c049f64b66f424cda5da3021dfce4462655ca (patch) | |
| tree | b4fd21e5e6f82be29b18c47d8617814b28c159a6 /mingling_core/src/lib.rs | |
| parent | 2097238b57810d78989d3ecab8bc97ce1b8a6aa1 (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/lib.rs')
| -rw-r--r-- | mingling_core/src/lib.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/mingling_core/src/lib.rs b/mingling_core/src/lib.rs index 2cb24b9..31476c9 100644 --- a/mingling_core/src/lib.rs +++ b/mingling_core/src/lib.rs @@ -90,8 +90,14 @@ pub mod setup { /// Private API — not intended for direct use. #[doc(hidden)] pub mod __private { + use crate::ProgramCollect; + /// Sealed trait for `StructuralData` — only implementable via derive macro. - pub trait StructuralDataSealed {} + pub trait StructuralDataSealed<C> + where + C: ProgramCollect<Enum = C>, + { + } /// Re-export so the derive macro can reference the trait without /// conflicting with the derive macro name at `::mingling::StructuralData`. |
