aboutsummaryrefslogtreecommitdiff
path: root/mingling_core/src/any/group.rs
diff options
context:
space:
mode:
Diffstat (limited to 'mingling_core/src/any/group.rs')
-rw-r--r--mingling_core/src/any/group.rs28
1 files changed, 11 insertions, 17 deletions
diff --git a/mingling_core/src/any/group.rs b/mingling_core/src/any/group.rs
index cb847d9..2813ad5 100644
--- a/mingling_core/src/any/group.rs
+++ b/mingling_core/src/any/group.rs
@@ -1,34 +1,28 @@
-use crate::{AnyOutput, ChainProcess};
+use crate::{AnyOutput, ChainProcess, ProgramCollect, Routable};
/// Used to mark a type with a unique enum ID, assisting dynamic dispatch
///
-/// **Note:** Unlike earlier versions, `Groupped` no longer requires `Serialize`
+/// **Note:** Unlike earlier versions, `Grouped` no longer requires `Serialize`
/// even when the `structural_renderer` feature is enabled. Structured output is
/// controlled separately via the \[`StructuralData`\] trait.
-pub trait Groupped<Group>
+pub trait Grouped<Group>
where
Self: Sized + 'static,
{
/// Returns the specific enum value representing its ID within that enum
fn member_id() -> Group;
+}
- /// Converts the grouped 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<Group>
- where
- Self: Send,
- {
+impl<T, C> Routable<C> for T
+where
+ C: ProgramCollect<Enum = C>,
+ T: Grouped<C> + Send,
+{
+ fn to_chain(self) -> ChainProcess<C> {
AnyOutput::new(self).route_chain()
}
- /// Converts the grouped 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<Group>
- where
- Self: Send,
- {
+ fn to_render(self) -> ChainProcess<C> {
AnyOutput::new(self).route_renderer()
}
}