aboutsummaryrefslogtreecommitdiff
path: root/CHANGELOG.md
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-07-19 05:26:21 +0800
committer魏曹先生 <1992414357@qq.com>2026-07-19 05:26:21 +0800
commit1c220b52903f05df1246802c24250300038cadb7 (patch)
tree125bb8cdd2dd2ff665890b835eca88930c343752 /CHANGELOG.md
parent961efae6bbd1e3d574a382c7c7f1a2c2267a7186 (diff)
feat(macros:chain): accept any return type in chain functions
Diffstat (limited to 'CHANGELOG.md')
-rw-r--r--CHANGELOG.md27
1 files changed, 27 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ea4b737..6c70d3d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -184,6 +184,33 @@ None
These methods complement the existing read-only `get_args(&self)` method, providing full control over argument mutation and ownership.
+9. **[`macros:chain`]** Relaxed the `#[chain]` return type validation. Previously, `#[chain]` functions were restricted to returning `Next`, `ChainProcess<ThisProgram>`, `()`, or omitting the return type. Now, any return type is accepted, and the generated `proc` function performs an explicit `Into<ChainProcess<ThisProgram>>` conversion using a fully-qualified turbofish based on the user-declared return type.
+
+ This means `#[chain]` functions can now return any pack type directly, without needing an explicit `.into()` call in the function body:
+
+ ```rust
+ // Before — required explicit .into()
+ #[chain]
+ fn handle_greet(args: EntryGreet) -> Next {
+ let name = /* ... */;
+ ResultGreeting::new(name).into()
+ }
+
+ // After — return any pack type directly
+ #[chain]
+ fn handle_greet(args: EntryGreet) -> ResultGreeting {
+ let name = /* ... */;
+ ResultGreeting::new(name)
+ }
+ ```
+
+ The generated `proc` function now wraps the body result in `<UserReturnType as Into<ChainProcess<ThisProgram>>>::into(...)`, which:
+ - Works for `Next` / `ChainProcess` via the identity `From<T> for T` implementation.
+ - Works for any pack type (`ResultGreeting`, etc.) via the `.into()` conversion generated by `pack!` / `#[derive(Groupped)]`.
+ - Works for `()` via the `From<()>` implementation on `ChainProcess`.
+
+ The return type validation has been removed entirely — any valid Rust return type is accepted. If the type does not implement `Into<ChainProcess<ThisProgram>>`, a standard Rust compilation error will be produced at the call site.
+
#### **BREAKING CHANGES** (API CHANGES):
1. **[`macros:renderer`]** **[`macros:help`]** Removed `r_println!` and `r_print!` macros. The `#[renderer]` and `#[help]` macros no longer implicitly inject an internal `RenderResult` variable or provide `r_println!` / `r_print!` macros.