aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-08-14 00:35:46 +0800
committer魏曹先生 <1992414357@qq.com>2026-08-14 00:35:46 +0800
commit1771304c59f6bdf162ed655c8fbc69d478600bf5 (patch)
tree7cad91be8e99beee9150c911efe570edf8ff1746
parent299b96c8917a7b2c70c9e8040c064d3186ecd760 (diff)
refactor: replace with_dispatchers with chained with_dispatcher calls
-rw-r--r--examples/example-lazy-resources/src/main.rs2
-rw-r--r--examples/example-resources/src/main.rs4
-rw-r--r--examples/example-setup/src/main.rs8
-rw-r--r--mingling/src/example_docs.rs15
4 files changed, 20 insertions, 9 deletions
diff --git a/examples/example-lazy-resources/src/main.rs b/examples/example-lazy-resources/src/main.rs
index aaafb98..7dda658 100644
--- a/examples/example-lazy-resources/src/main.rs
+++ b/examples/example-lazy-resources/src/main.rs
@@ -64,7 +64,7 @@ fn main() {
program.with_resource(ResLargeData::lazy_init(init_res_large_data));
// --------- IMPORTANT ---------
- program.with_dispatchers((CMDShow, CMDNone));
+ program.with_dispatcher(CMDShow).with_dispatcher(CMDNone);
program.exec_and_exit();
}
diff --git a/examples/example-resources/src/main.rs b/examples/example-resources/src/main.rs
index 60c5c08..38e4561 100644
--- a/examples/example-resources/src/main.rs
+++ b/examples/example-resources/src/main.rs
@@ -37,7 +37,9 @@ fn main() {
});
// --------- IMPORTANT ---------
- program.with_dispatchers((CMDCurrent, CMDModifyCurrent));
+ program
+ .with_dispatcher(CMDCurrent)
+ .with_dispatcher(CMDModifyCurrent);
program.exec_and_exit();
}
diff --git a/examples/example-setup/src/main.rs b/examples/example-setup/src/main.rs
index cd432dd..bf610ca 100644
--- a/examples/example-setup/src/main.rs
+++ b/examples/example-setup/src/main.rs
@@ -2,7 +2,7 @@
//!
//! > This example demonstrates how to build a custom Setup for modular management of project components
-use mingling::{macros::program_setup, prelude::*, Program};
+use mingling::{Program, macros::program_setup, prelude::*};
fn main() {
let mut program = ThisProgram::new();
@@ -20,7 +20,11 @@ fn main() {
// Package part of the program construction logic into this type for modular management
#[program_setup]
fn custom_setup(program: &mut Program<ThisProgram>) {
- program.with_dispatchers((CMD1, CMD2, CMD3, CMD4, CMD5));
+ program.with_dispatcher(CMD1);
+ program.with_dispatcher(CMD2);
+ program.with_dispatcher(CMD3);
+ program.with_dispatcher(CMD4);
+ program.with_dispatcher(CMD5);
}
// --------- IMPORTANT ---------
diff --git a/mingling/src/example_docs.rs b/mingling/src/example_docs.rs
index 930e32d..fb0a6fc 100644
--- a/mingling/src/example_docs.rs
+++ b/mingling/src/example_docs.rs
@@ -1,4 +1,3 @@
-// Doc Not Optimize
// Auto generated
/// Example Argument Parse
@@ -1967,7 +1966,7 @@ pub mod example_implicit_dispatcher {}
/// program.with_resource(ResLargeData::lazy_init(init_res_large_data));
/// // --------- IMPORTANT ---------
///
-/// program.with_dispatchers((CMDShow, CMDNone));
+/// program.with_dispatcher(CMDShow).with_dispatcher(CMDNone);
/// program.exec_and_exit();
/// }
///
@@ -2847,7 +2846,9 @@ pub mod example_repl_basic {}
/// });
/// // --------- IMPORTANT ---------
///
-/// program.with_dispatchers((CMDCurrent, CMDModifyCurrent));
+/// program
+/// .with_dispatcher(CMDCurrent)
+/// .with_dispatcher(CMDModifyCurrent);
/// program.exec_and_exit();
/// }
///
@@ -2901,7 +2902,7 @@ pub mod example_resources {}
///
/// Source code (./src/main.rs)
/// ```ignore
-/// use mingling::{macros::program_setup, prelude::*, Program};
+/// use mingling::{Program, macros::program_setup, prelude::*};
///
/// fn main() {
/// let mut program = ThisProgram::new();
@@ -2919,7 +2920,11 @@ pub mod example_resources {}
/// // Package part of the program construction logic into this type for modular management
/// #[program_setup]
/// fn custom_setup(program: &mut Program<ThisProgram>) {
-/// program.with_dispatchers((CMD1, CMD2, CMD3, CMD4, CMD5));
+/// program.with_dispatcher(CMD1);
+/// program.with_dispatcher(CMD2);
+/// program.with_dispatcher(CMD3);
+/// program.with_dispatcher(CMD4);
+/// program.with_dispatcher(CMD5);
/// }
/// // --------- IMPORTANT ---------
///