aboutsummaryrefslogtreecommitdiff
path: root/mingling_core/src/program/flag.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/flag.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/flag.rs')
-rw-r--r--mingling_core/src/program/flag.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/mingling_core/src/program/flag.rs b/mingling_core/src/program/flag.rs
index 74435e4..84fae01 100644
--- a/mingling_core/src/program/flag.rs
+++ b/mingling_core/src/program/flag.rs
@@ -1,3 +1,5 @@
+use std::fmt::Display;
+
use crate::{Program, ProgramCollect};
pub struct Flag {
@@ -88,14 +90,15 @@ macro_rules! special_argument {
}};
}
-impl<C> Program<C>
+impl<C, G> Program<C, G>
where
C: ProgramCollect,
+ G: Display,
{
/// Registers a global argument (with value) and its handler.
pub fn global_argument<F, A>(&mut self, arguments: A, do_fn: F)
where
- F: Fn(&mut Program<C>, String),
+ F: Fn(&mut Program<C, G>, String),
A: Into<Flag>,
{
let flag = arguments.into();
@@ -111,7 +114,7 @@ where
/// Registers a global flag (boolean) and its handler.
pub fn global_flag<F, A>(&mut self, flag: A, do_fn: F)
where
- F: Fn(&mut Program<C>),
+ F: Fn(&mut Program<C, G>),
A: Into<Flag>,
{
let flag = flag.into();