From 148708ee685d8434f61c3e91503aa5a099742025 Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Thu, 8 Aug 2024 15:26:37 +0400 Subject: [PATCH] feat: convert 1st digit of status firstly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …to avoid converting incorrect status codes to `StatusCode` enum. I think it would give +0.001% to performance on invalid statuses :) --- src/status.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/status.rs b/src/status.rs index 2f817fb..47ce73c 100644 --- a/src/status.rs +++ b/src/status.rs @@ -103,10 +103,10 @@ impl Status { let code = first * 10 + second; Ok(Status { - // get enum item for 2-digit status code - status_code: StatusCode::try_from_primitive(code)?, - // get enum entry for first digit + // get enum entry for the first digit reply_type: ReplyType::try_from_primitive(first)?, + // get enum item for the 2-digit status code + status_code: StatusCode::try_from_primitive(code)?, // provide separate field for the 2nd digit second_digit: second, })