aboutsummaryrefslogtreecommitdiff
path: root/docs/_zh_CN/pages/other/features.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/_zh_CN/pages/other/features.md')
-rw-r--r--docs/_zh_CN/pages/other/features.md34
1 files changed, 17 insertions, 17 deletions
diff --git a/docs/_zh_CN/pages/other/features.md b/docs/_zh_CN/pages/other/features.md
index b04f1b8..f988a3a 100644
--- a/docs/_zh_CN/pages/other/features.md
+++ b/docs/_zh_CN/pages/other/features.md
@@ -19,15 +19,15 @@
```rust
// Features: ["async"]
-
+
pack!(StateFoo = ());
-
+
#[chain]
async fn handle_state_foo(foo: StateFoo) -> Next {
StateFoo::new(())
}
```
-
+
详见 [示例](https://mingling-rs.github.io/mingling/docs/example-viewer.html?name=example-async-support)
## 特性 `builds`
@@ -41,13 +41,13 @@ async fn handle_state_foo(foo: StateFoo) -> Next {
```rust
// Features: ["builds", "comp"]
use mingling::build::build_comp_scripts;
-
+
fn main() {
// 为 `myprogram` 生成补全脚本
build_comp_scripts("myprogram").unwrap();
}
```
-
+
## 特性 `clap`
**介绍:**
@@ -106,17 +106,17 @@ fn main() {
```rust
// Features: ["extra_macros"]
-
+
pack!(StatePrev1 = ());
pack!(StatePrev2 = ());
-
+
pack!(StateNext = ());
-
+
#[chain]
fn handle_state_prev2(_p: StatePrev1) {
// 无 Next 的 #[chain] 可以直接不返回值
}
-
+
#[chain]
fn handle_state_prev1(_p: StatePrev1) -> Next {
let foo = 1;
@@ -129,19 +129,19 @@ fn handle_state_prev1(_p: StatePrev1) -> Next {
}
}
```
-
+
### `#[program_setup]`
```rust
// Features: ["extra_macros"]
use mingling::{macros::program_setup, Program};
-
+
fn main() {
let mut program = ThisProgram::new();
program.with_setup(NoErrorSetup);
program.exec_and_exit();
}
-
+
#[program_setup]
fn no_error_setup(program: &mut Program<ThisProgram>) {
program.global_flag(["--no-error"], |program| {
@@ -149,24 +149,24 @@ fn no_error_setup(program: &mut Program<ThisProgram>) {
});
}
```
-
+
### `entry!`
```rust
// Features: ["extra_macros"]
use mingling::macros::entry;
-
+
pack!(EntryHello = Vec<String>);
-
+
fn main() {
let result = handle_hello(entry!("--name", "Bob")).into();
// ... 此处为断言逻辑
}
-
+
#[chain]
fn handle_hello(args: EntryHello) {}
```
-
+
</details>
## 特性 `general_renderer`