diff options
| author | Weicao-CatilGrass <1992414357@qq.com> | 2026-05-31 02:42:52 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-05-31 17:19:20 +0800 |
| commit | 2aa7bda3cb21ce6c052b82e08bcab79a625d04f2 (patch) | |
| tree | f10b89007fc67ca1a948f34abe6869b49296b932 /examples/example-unit-test/src | |
| parent | 3aa409a55e4f2f0ab41b0949cc06eb13c2da4a43 (diff) | |
Enhance code quality across the entire codebase
Diffstat (limited to 'examples/example-unit-test/src')
| -rw-r--r-- | examples/example-unit-test/src/main.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/examples/example-unit-test/src/main.rs b/examples/example-unit-test/src/main.rs index 62c7fbf..7808d0d 100644 --- a/examples/example-unit-test/src/main.rs +++ b/examples/example-unit-test/src/main.rs @@ -89,26 +89,31 @@ fn handle_hello(args: EntryHello) -> Next { ResultName::new(name).to_render() } +/// Renders a successful greeting with the given name. #[renderer] fn render_result_name(name: ResultName) -> String { r_println!("Hello, {}!", *name); } +/// Renders the error when no name is provided. #[renderer] fn render_error_no_name_provided(_: ErrorNoNameProvided) -> String { r_println!("No name provided"); } +/// Renders the error when the name is already taken. #[renderer] fn render_error_name_not_available(_: ErrorNameNotAvailable) -> String { r_println!("Name not available"); } +/// Renders the error when the name exceeds the maximum length. #[renderer] fn render_error_name_too_long(len: ErrorNameTooLong) -> String { r_println!("Name too long: {} > 10", *len); } +/// Renders the error when the dispatcher (subcommand) is not found. #[renderer] fn render_dispatcher_not_found(err: ErrorDispatcherNotFound) { r_println!("Command not found: \"{}\"", err.inner.join(" ")); |
