From 9411f2570cbd494aebefa2b97b6b5a1a5e68bb27 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Sun, 19 Apr 2026 00:49:09 +0800 Subject: Remove async runtime requirement from examples --- docs/pages/2-basic/1-program.md | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'docs/pages/2-basic/1-program.md') diff --git a/docs/pages/2-basic/1-program.md b/docs/pages/2-basic/1-program.md index fd8e986..ae22896 100644 --- a/docs/pages/2-basic/1-program.md +++ b/docs/pages/2-basic/1-program.md @@ -45,12 +45,11 @@ use mingling::{ setup::BasicProgramSetup }; -#[tokio::main] -async fn main() { +fn main() { let mut program = ThisProgram::new(); // Add `BasicProgramSetup` program.with_setup(BasicProgramSetup); - program.exec().await; + program.exec(); } // Generate `ThisProgram` @@ -68,8 +67,7 @@ dispatcher!("member.add", dispatcher!("member.rm", RemoveMemberCommand => RemoveMemberEntry); -#[tokio::main] -async fn main() { +fn main() { let mut program = ThisProgram::new(); // Register Dispatchers @@ -82,7 +80,7 @@ async fn main() { RemoveMemberCommand )); - program.exec().await; + program.exec(); } ``` @@ -91,8 +89,7 @@ async fn main() { You can extract global arguments before the program runs to control the global state of the `Program`: ```rust -#[tokio::main] -async fn main() { +fn main() { let mut program = ThisProgram::new(); let mut output = current_dir().unwrap(); @@ -109,7 +106,7 @@ async fn main() { |_, v| output = PathBuf::from(v) ); - program.exec().await; + program.exec(); } ``` -- cgit