aboutsummaryrefslogtreecommitdiff
path: root/mingling_core/src/program/hint.rs
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-04-01 15:48:41 +0800
committer魏曹先生 <1992414357@qq.com>2026-04-01 15:48:41 +0800
commit3de10ca22cca06c4d9069984d0e66e370a331dde (patch)
tree7e8a9b035c360c016cde848b3442d3e1d5dcac5e /mingling_core/src/program/hint.rs
parentf3d6f76dfd07c35dabc11aa86d86c3671cd283c5 (diff)
Replace typeid-based dispatch with enum-based dispatch
- Add `Groupped` trait and `member_id` to `AnyOutput` - Add generic parameter `G` to `Dispatcher`, `Chain`, `Program` etc - Remove `hint` module and its marker types - Update macros to support explicit group specification - Add `gen_program` macro for generating enum-based programs - Add `GroupProcess` marker type for type-level grouping
Diffstat (limited to 'mingling_core/src/program/hint.rs')
-rw-r--r--mingling_core/src/program/hint.rs62
1 files changed, 0 insertions, 62 deletions
diff --git a/mingling_core/src/program/hint.rs b/mingling_core/src/program/hint.rs
deleted file mode 100644
index 6dbbac2..0000000
--- a/mingling_core/src/program/hint.rs
+++ /dev/null
@@ -1,62 +0,0 @@
-use crate::{AnyOutput, ChainProcess, Dispatcher, Node};
-
-/// Marker: Dispatcher Not Found
-///
-/// If a Dispatcher outputs NoDispatcherFound to the Chain,
-/// the program will terminate directly.
-///
-/// You can implement Renderer for NoDispatcherFound
-/// to render relevant information when a Dispatcher cannot be found.
-#[cfg_attr(feature = "general_renderer", derive(serde::Serialize))]
-pub struct NoDispatcherFound {
- pub args: Vec<String>,
-}
-
-#[derive(Default)]
-#[cfg_attr(feature = "general_renderer", derive(serde::Serialize))]
-pub struct DispatcherNotFound;
-impl Dispatcher for DispatcherNotFound {
- fn node(&self) -> crate::Node {
- Node::default().join("_not_found")
- }
-
- fn begin(&self, args: Vec<String>) -> ChainProcess {
- AnyOutput::new(NoDispatcherFound { args }).route_renderer()
- }
-
- fn clone_dispatcher(&self) -> Box<dyn Dispatcher> {
- Box::new(DispatcherNotFound)
- }
-}
-
-/// Marker: Renderer Not Found
-///
-/// If a Chain outputs NoRendererFound to the Chain,
-/// the program will terminate directly.
-///
-/// You can implement Renderer for NoRendererFound
-/// to render relevant information when a Renderer cannot be found.
-#[cfg_attr(feature = "general_renderer", derive(serde::Serialize))]
-pub struct NoRendererFound {
- pub type_to_render: String,
-}
-
-#[derive(Default)]
-#[cfg_attr(feature = "general_renderer", derive(serde::Serialize))]
-pub struct RendererNotFound;
-impl Dispatcher for RendererNotFound {
- fn node(&self) -> crate::Node {
- Node::default().join("_not_found")
- }
-
- fn begin(&self, args: Vec<String>) -> ChainProcess {
- AnyOutput::new(NoRendererFound {
- type_to_render: args.first().unwrap().clone(),
- })
- .route_renderer()
- }
-
- fn clone_dispatcher(&self) -> Box<dyn Dispatcher> {
- Box::new(RendererNotFound)
- }
-}