From 3de10ca22cca06c4d9069984d0e66e370a331dde Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Wed, 1 Apr 2026 15:48:41 +0800 Subject: 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 --- mingling_core/src/program/flag.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'mingling_core/src/program/flag.rs') 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 Program +impl Program where C: ProgramCollect, + G: Display, { /// Registers a global argument (with value) and its handler. pub fn global_argument(&mut self, arguments: A, do_fn: F) where - F: Fn(&mut Program, String), + F: Fn(&mut Program, String), A: Into, { let flag = arguments.into(); @@ -111,7 +114,7 @@ where /// Registers a global flag (boolean) and its handler. pub fn global_flag(&mut self, flag: A, do_fn: F) where - F: Fn(&mut Program), + F: Fn(&mut Program), A: Into, { let flag = flag.into(); -- cgit