From ec88e6a1682740c64cb3735016632542e69f9e53 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Sun, 19 Jul 2026 10:53:33 +0800 Subject: 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 --- mingling_core/src/asset/routable.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 mingling_core/src/asset/routable.rs (limited to 'mingling_core/src/asset') diff --git a/mingling_core/src/asset/routable.rs b/mingling_core/src/asset/routable.rs new file mode 100644 index 0000000..24b7bb1 --- /dev/null +++ b/mingling_core/src/asset/routable.rs @@ -0,0 +1,22 @@ +use crate::ChainProcess; + +/// Provides routing capabilities for converting an item into a `ChainProcess` +/// directed to either the chain or render processing pipeline. +/// +/// This trait enables items to be dispatched to different processing routes +/// (chain or render) by wrapping them into an `AnyOutput` and routing them +/// through the appropriate pipeline. +pub trait Routable +where + Self: Sized + 'static, +{ + /// Converts the routable item into a `ChainProcess` directed to the chain route. + /// + /// This wraps the item into an `AnyOutput` and routes it to the chain processing pipeline. + fn to_chain(self) -> ChainProcess; + + /// Converts the routable item into a `ChainProcess` directed to the render route. + /// + /// This wraps the item into an `AnyOutput` and routes it to the render processing pipeline. + fn to_render(self) -> ChainProcess; +} -- cgit