aboutsummaryrefslogtreecommitdiff
path: root/CHANGELOG.md
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-07-18 00:44:24 +0800
committer魏曹先生 <1992414357@qq.com>2026-07-18 00:44:24 +0800
commitb55c1815f175dec07d94c8f7f2dbbd01d4832caa (patch)
tree4bb8b456cc26f4b02cdb799c864f680e4aca7bde /CHANGELOG.md
parente938129acc6231b2224db793c7aa9d6f95f7d0bf (diff)
feat(core): add multiple From implementations for RenderResult
Implement `From<()>`, integer types, String, &String, and &str to allow renderers to return simple values directly
Diffstat (limited to 'CHANGELOG.md')
-rw-r--r--CHANGELOG.md8
1 files changed, 8 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ac00643..a3493b0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -108,6 +108,14 @@ None
_No migration is required for existing `parser` users — the old API continues to work unchanged._
+4. **[`core`]** Added multiple `From` implementations for `RenderResult`:
+
+ - **From `()`** — Allows constructing an empty `RenderResult` from a unit value, enabling ergonomic returns like `fn my_renderer() -> RenderResult { }` (via `}` → `}` with implicit `()` return).
+ - **From integer types** (`i32`, `i16`, `i8`, `u32`, `u16`, `u8`, `usize`) — Allows constructing a `RenderResult` with a specific exit code and empty text, enabling `fn my_renderer() -> RenderResult { 0 }` or `42.into()`.
+ - **From `String`**, **`&String`**, and **`&str`** — Allows constructing a `RenderResult` with the given text and exit code `0`, enabling `fn my_renderer() -> RenderResult { "Hello".into() }` or passing a `String` directly.
+
+ These implementations make `RenderResult` more flexible as a return type, allowing renderer functions to return simple values without manually constructing a `RenderResult` via `new()` and `write!`/`writeln!`.
+
#### **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.