feat: convert 1st digit of status firstly

…to avoid converting incorrect status codes to `StatusCode` enum.
I think it would give +0.001% to performance on invalid statuses :)
This commit is contained in:
DarkCat09 2024-08-08 15:26:37 +04:00
parent 61828f18d2
commit 148708ee68
Signed by: DarkCat09
GPG key ID: 0A26CD5B3345D6E3

View file

@ -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,
})