diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-07-19 10:53:33 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-07-19 10:54:27 +0800 |
| commit | ec88e6a1682740c64cb3735016632542e69f9e53 (patch) | |
| tree | 031a6e6512f07757ee832e288208c425f794c5de /mingling_core/src/any | |
| parent | 320ea9a3a418daa17174dc78f1262509b96b13b9 (diff) | |
feat(macros): add Routable trait and update route! macro
Introduce a `Routable` trait with `to_chain` and `to_render`
methods, replacing direct `Grouped` usage in the `route!` macro
so error branches correctly route through the rendering pipeline
Diffstat (limited to 'mingling_core/src/any')
| -rw-r--r-- | mingling_core/src/any/group.rs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/mingling_core/src/any/group.rs b/mingling_core/src/any/group.rs index 14663db..90ef9fc 100644 --- a/mingling_core/src/any/group.rs +++ b/mingling_core/src/any/group.rs @@ -1,4 +1,4 @@ -use crate::{AnyOutput, ChainProcess}; +use crate::{AnyOutput, ChainProcess, ProgramCollect, Routable}; /// Used to mark a type with a unique enum ID, assisting dynamic dispatch /// @@ -32,3 +32,17 @@ where AnyOutput::new(self).route_renderer() } } + +impl<T, C> Routable<C> for T +where + C: ProgramCollect<Enum = C>, + T: Grouped<C> + Send, +{ + fn to_chain(self) -> ChainProcess<C> { + T::to_chain(self) + } + + fn to_render(self) -> ChainProcess<C> { + T::to_render(self) + } +} |
