Skip to content
This repository was archived by the owner on Oct 28, 2025. It is now read-only.

Commit 67c906f

Browse files
author
Кирилл Безуглый
committed
feat: add introspection for network::protocol::codec::IProtoType
1 parent 83c9fef commit 67c906f

File tree

1 file changed

+34
-33
lines changed

1 file changed

+34
-33
lines changed

tarantool/src/network/protocol/codec.rs

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -50,39 +50,40 @@ pub mod iproto_key {
5050
}
5151
use iproto_key::*;
5252

53-
/// Iproto packet type.
54-
///
55-
/// See `enum iproto_type` in \<tarantool>/src/box/iproto_constants.h for source
56-
/// of truth.
57-
#[derive(Debug)]
58-
#[non_exhaustive]
59-
pub enum IProtoType {
60-
/// This packet is a response with status success.
61-
Ok = 0,
62-
Select = 1,
63-
Insert = 2,
64-
Replace = 3,
65-
Update = 4,
66-
Delete = 5,
67-
/// Deprecated in Tarantool 1.6 with name `IPROTO_CALL_16`.
68-
/// Superseeded by `IPROTO_CALL`, see [`IProtoType::Call`].
69-
LegacyCall = 6,
70-
Auth = 7,
71-
Eval = 8,
72-
Upsert = 9,
73-
Call = 10,
74-
Execute = 11,
75-
Nop = 12,
76-
Prepare = 13,
77-
Begin = 14,
78-
Commit = 15,
79-
Rollback = 16,
80-
// ...
81-
Ping = 64,
82-
// ...
83-
/// Error marker. This value will be combined with the error code in the
84-
/// actual iproto response: `(IProtoType::Error | error_code)`.
85-
Error = 1 << 15,
53+
crate::define_enum_with_introspection! {
54+
/// Iproto packet type.
55+
///
56+
/// See `enum iproto_type` in \<tarantool>/src/box/iproto_constants.h for source
57+
/// of truth.
58+
#[non_exhaustive]
59+
pub enum IProtoType {
60+
/// This packet is a response with status success.
61+
Ok = 0,
62+
Select = 1,
63+
Insert = 2,
64+
Replace = 3,
65+
Update = 4,
66+
Delete = 5,
67+
/// Deprecated in Tarantool 1.6 with name `IPROTO_CALL_16`.
68+
/// Superseeded by `IPROTO_CALL`, see [`IProtoType::Call`].
69+
LegacyCall = 6,
70+
Auth = 7,
71+
Eval = 8,
72+
Upsert = 9,
73+
Call = 10,
74+
Execute = 11,
75+
Nop = 12,
76+
Prepare = 13,
77+
Begin = 14,
78+
Commit = 15,
79+
Rollback = 16,
80+
// ...
81+
Ping = 64,
82+
// ...
83+
/// Error marker. This value will be combined with the error code in the
84+
/// actual iproto response: `(IProtoType::Error | error_code)`.
85+
Error = 1 << 15,
86+
}
8687
}
8788

8889
pub fn chap_sha1_auth_data(password: &str, salt: &[u8]) -> Vec<u8> {

0 commit comments

Comments
 (0)