diff options
Diffstat (limited to 'examples/example-unit-test')
| -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(" ")); |
