From 2c0565624d9f44972d86fb09c772e84e13252771 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Sun, 21 Jun 2026 14:44:16 +0900 Subject: [PATCH] commands: implement `Default` for empty req/res structs --- src/commands.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/commands.rs b/src/commands.rs index c55c49b..2251b73 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -189,6 +189,12 @@ macro_rules! empty_command_request { pub struct [<$name Request>]; } + impl std::default::Default for paste::paste! { [<$name Request>] } { + fn default() -> Self { + paste::paste! { [<$name Request>] } + } + } + impl crate::commands::CommandRequest for paste::paste! { [<$name Request>] } { const COMMAND: &'static str = $command_name; const MIN_ARGS: u32 = 0; @@ -216,6 +222,12 @@ macro_rules! empty_command_response { pub struct [<$name Response>]; } + impl std::default::Default for paste::paste! { [<$name Response>] } { + fn default() -> Self { + paste::paste! { [<$name Response>] } + } + } + impl crate::commands::CommandResponse for paste::paste! { [<$name Response>] } { fn parse( _parts: crate::commands::ResponseAttributes<'_>,