aboutsummaryrefslogtreecommitdiff
path: root/examples/example-basic/src
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-04-19 00:31:05 +0800
committer魏曹先生 <1992414357@qq.com>2026-04-19 00:31:05 +0800
commit532f4ceba2bddb1c84d2e0bdd69808a3ebd5ca4a (patch)
tree043514a2aca670d8b2398726b17aab1066938ba1 /examples/example-basic/src
parentecc1329bbd31cd98fa9b4c2f25a3114f133987ae (diff)
Make async an optional feature
Diffstat (limited to 'examples/example-basic/src')
-rw-r--r--examples/example-basic/src/main.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/examples/example-basic/src/main.rs b/examples/example-basic/src/main.rs
index 9aaff06..a35cac6 100644
--- a/examples/example-basic/src/main.rs
+++ b/examples/example-basic/src/main.rs
@@ -13,8 +13,7 @@ use mingling::{
// Define dispatcher `HelloCommand`, directing subcommand "hello" to `HelloEntry`
dispatcher!("hello", HelloCommand => HelloEntry);
-#[tokio::main]
-async fn main() {
+fn main() {
// Create program
let mut program = ThisProgram::new();
@@ -22,7 +21,7 @@ async fn main() {
program.with_dispatcher(HelloCommand);
// Run program
- program.exec().await;
+ program.exec();
}
// Register wrapper type `Hello`, setting inner to `String`
@@ -30,7 +29,7 @@ pack!(Hello = String);
// Register chain to `ThisProgram`, handling logic from `HelloEntry`
#[chain]
-async fn parse_name(prev: HelloEntry) -> NextProcess {
+fn parse_name(prev: HelloEntry) -> NextProcess {
// Extract string from `HelloEntry` as argument
let name = prev.first().cloned().unwrap_or_else(|| "World".to_string());