From 2bb934186300dceb2a0f0bcd4dc6d12d051f55ac Mon Sep 17 00:00:00 2001 From: h7x4 Date: Mon, 8 Dec 2025 16:25:04 +0900 Subject: [PATCH] commands: clearly define how arguments are counted in request error --- src/commands.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/commands.rs b/src/commands.rs index 2270624..8b967d9 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -60,7 +60,11 @@ where /// The minimum number of arguments this command takes const MIN_ARGS: u32; - /// The maximum number of arguments this command takes + /// The maximum number of arguments this command takes. + /// + /// Note that in the case of keyworded arguments, such as + /// `group `, `sort `, etc., these are + /// counted as a single argument despite being two tokens. const MAX_ARGS: Option; /// Helper function to create a [`RequestParserError::TooManyArguments`] error @@ -555,6 +559,10 @@ pub enum RequestParserError { )] SubtypeParserError { /// The index of the argument that failed to parse + /// + /// Note that in the case of keyworded arguments, such as + /// `group `, `sort `, etc., these are + /// counted as a single argument despite being two tokens. argument_index: u32, /// The expected type of the argument @@ -577,6 +585,10 @@ pub enum RequestParserError { expected_max: Option, /// The number of arguments that were found + /// + /// Note that in the case of keyworded arguments, such as + /// `group `, `sort `, etc., these are + /// counted as a single argument despite being two tokens. found: u32, }, @@ -593,6 +605,10 @@ pub enum RequestParserError { expected_max: Option, /// The number of arguments that were found + /// + /// Note that in the case of keyworded arguments, such as + /// `group `, `sort `, etc., these are + /// counted as a single argument despite being two tokens. found: u32, },