diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-07-10 16:42:31 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-07-10 16:42:31 +0800 |
| commit | a8c8d50b6c59b103da7fd4bbb5e7ca3ff7b2f49a (patch) | |
| tree | 5e2805953c58740a7058fe809174e68cf3a4937b | |
| parent | 032fe9a3a621511977892d719e020113d45232ae (diff) | |
docs: fix trailing whitespace in markdown files
| -rw-r--r-- | docs/dev/pages/issues/remove-r-print-macro.md | 12 | ||||
| -rw-r--r-- | docs/dev/pages/issues/the-shit-time.md | 10 |
2 files changed, 16 insertions, 6 deletions
diff --git a/docs/dev/pages/issues/remove-r-print-macro.md b/docs/dev/pages/issues/remove-r-print-macro.md index 53fa086..96f99ef 100644 --- a/docs/dev/pages/issues/remove-r-print-macro.md +++ b/docs/dev/pages/issues/remove-r-print-macro.md @@ -20,7 +20,7 @@ macro_rules! my_println { r_println!("Custom: {}", format!($($arg)*)); }; } - + #[renderer] fn render_something(_p: ResultSomething) { // Although this function body has __renderer_inner_result injected, @@ -34,7 +34,7 @@ fn render_something(_p: ResultSomething) { my_println!("{}", box_val); // Compile error: cannot find __renderer_inner_result } ``` - + ## Deeper Issues I have to admit, this is an early design flaw. After re-examining the code, I found the problem goes beyond "can't be wrapped". @@ -58,11 +58,11 @@ fn render_something(prev: ResultSomething) -> RenderResult { result.println(prev.to_string()); // or write!(result, "{}", prev.to_string()); - + result // return here } ``` - + Clear boundaries — the entire rendering process is confined within the function body decorated by `#[help]` or `#[renderer]`, without introducing extra out-of-scope dependencies. The trade-off is slightly more boilerplate compared to the original approach. ### Option 2: Resource Injection @@ -73,11 +73,11 @@ fn render_something(prev: ResultSomething, result: &mut ResRenderResult) { result.println(prev.to_string()); // or write!(result, "{}", prev.to_string()); - + result // return here } ``` - + More flexible, but blurs the boundary between logic functions like `#[chain]` and rendering functions like `#[help]`. ### Preferred Direction diff --git a/docs/dev/pages/issues/the-shit-time.md b/docs/dev/pages/issues/the-shit-time.md index f524f42..9d6c429 100644 --- a/docs/dev/pages/issues/the-shit-time.md +++ b/docs/dev/pages/issues/the-shit-time.md @@ -83,6 +83,16 @@ fn desc_add() -> String { t!("cmd.add.desc") } +// Or + +#[completion(CMDAdd)] +fn desc_add(_ctx: &ShellContext) -> Suggest { + // If using rust_i18n + suggest{ + t!("cmd.add.desc") + } +} + // Collected and generated by `gen_program!()` // Generate something like get_dispatcher_desc(id: &ThisProgram) -> String // Match the corresponding function using enum values inside ThisProgram |
