diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-07-19 10:58:11 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-07-19 10:58:11 +0800 |
| commit | 677600e91f321a23d869ee94e66f8b716ec0ce8f (patch) | |
| tree | c1b96d7b0f13f5513d2e0f26078423920d2cb868 | |
| parent | ec88e6a1682740c64cb3735016632542e69f9e53 (diff) | |
feat(macros): update `route!` to use `Routable` trait for error routing
Add `Routable` implementation for `ChainProcess<ThisProgram>` to enable
direct routing of chain process values through the `route!` macro
without
double-wrapping, improving semantics and flexibility of error conversion
| -rw-r--r-- | CHANGELOG.md | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index d45e4b7..997eac0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,7 +58,13 @@ None #### Optimizations: -None +1. **[`macros`]** Updated `route!` macro to use `Routable` trait instead of `Grouped` trait for error conversion, making the semantics clearer. The `route!` macro now calls `::mingling::Routable::to_chain(e)` on the error branch instead of `::mingling::Grouped::to_chain(e)`. + + Additionally, `ChainProcess<ThisProgram>` now implements `Routable<ThisProgram>`, allowing `route!` to work with `Result<Ok, ChainProcess<ThisProgram>>` patterns — where the error side is already a `ChainProcess` value that should be routed directly: + + When `ChainProcess` implements `Routable`, `to_chain()` re-routes the inner `AnyOutput` to the chain pipeline (preserving the existing `NextProcess::Chain`/`Renderer` flag), while `to_render()` re-routes it to the render pipeline. This enables seamless propagation of already-routed chain process values through the `route!` macro without double-wrapping. + + The `Routable` trait is defined in `mingling_core::asset::routable` and provides unified routing capabilities (`to_chain` / `to_render`) for any type that can be dispatched into the program's pipeline. A blanket implementation is provided for all `T: Grouped<C> + Send`, ensuring backward compatibility — existing types that implement `Grouped` automatically implement `Routable`. #### Features: |
