aboutsummaryrefslogtreecommitdiff
path: root/docs/pages/5-multiple-commands.md
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-07-18 01:53:59 +0800
committer魏曹先生 <1992414357@qq.com>2026-07-18 01:53:59 +0800
commitf5a4cebde2f12eb980de73ea41eb8d9e133ae49a (patch)
treef0b5c550acf5a47cab03df8d3ff7292e7145e6b5 /docs/pages/5-multiple-commands.md
parent7b4c511cbd2429ca482a24b7256de785d9430445 (diff)
ix(macros)!: require explicit `.into()` on chain function return values
Diffstat (limited to 'docs/pages/5-multiple-commands.md')
-rw-r--r--docs/pages/5-multiple-commands.md8
1 files changed, 4 insertions, 4 deletions
diff --git a/docs/pages/5-multiple-commands.md b/docs/pages/5-multiple-commands.md
index a56f7b0..d9a335a 100644
--- a/docs/pages/5-multiple-commands.md
+++ b/docs/pages/5-multiple-commands.md
@@ -20,13 +20,13 @@ pack!(ResultSum = i32);
#[chain]
fn handle_greet(args: EntryGreet) -> Next {
let name = args.inner.first().cloned().unwrap_or_else(|| "World".to_string());
- ResultGreeting::new(name)
+ ResultGreeting::new(name).into()
}
#[chain]
fn handle_add(args: EntryAdd) -> Next {
let sum: i32 = args.inner.iter().filter_map(|s| s.parse::<i32>().ok()).sum();
- ResultSum::new(sum)
+ ResultSum::new(sum).into()
}
#[renderer]
@@ -70,9 +70,9 @@ Notice `with_dispatchers`? When you need to register multiple dispatchers, just
@@@dispatcher!("add", CMDAdd => EntryAdd);
@@@pack!(ResultGreeting = String);
@@@pack!(ResultSum = i32);
-@@@#[chain] fn handle_greet(_args: EntryGreet) -> Next { ResultGreeting::new("ok".into()) }
+@@@#[chain] fn handle_greet(_args: EntryGreet) -> Next { ResultGreeting::new("ok".into()).into() }
@@@#[renderer] fn render_greet(_greeting: ResultGreeting) -> RenderResult { RenderResult::new() }
-@@@#[chain] fn handle_add(_args: EntryAdd) -> Next { ResultSum::new(0) }
+@@@#[chain] fn handle_add(_args: EntryAdd) -> Next { ResultSum::new(0).into() }
@@@#[renderer] fn render_sum(_sum: ResultSum) -> RenderResult { RenderResult::new() }
fn main() {
let mut program = ThisProgram::new();