1use int_enum::IntEnum;
2
3#[derive(Clone, Eq, Copy, PartialEq, Debug, IntEnum)]
4#[repr(u16)]
5pub enum CoreObjectType {
6 Zone = 32,
8
9 Admin = 33,
11
12 Storage = 40,
14
15 Text = 41,
17
18 FriendOption = 131,
21 FriendProperty = 132,
22
23 BlockV1 = 300,
25 MetaProto = 301,
26 MetaMinerGroup = 302,
27 BlockV2 = 303,
28
29 TransContext = 350,
31 DecApp = 400,
33 AppStatus = 401,
34 AppList = 402,
35 AppStoreList = 405,
40 AppExtInfo = 406,
41
42 DefaultAppList = 407,
44 SetDefaultApp = 408,
45
46 AppCmd = 410,
49 AppLocalStatus = 411,
51 AppCmdList = 413,
53 AppSetting = 414,
54 AppManagerAction = 415,
55 AppLocalList = 416,
56
57 NFTList = 500,
59
60 PerfOperation = 600,
62
63 AddFriend = 1001,
65 Msg = 1003,
66 RemoveFriend = 1004,
67
68 ErrObjType = 32767,
71}
72
73impl Into<u16> for CoreObjectType {
74 fn into(self) -> u16 {
75 self as u16
76 }
77}
78
79impl From<u16> for CoreObjectType {
80 fn from(value: u16) -> Self {
81 match Self::from_int(value) {
82 Ok(v) => v,
83 Err(e) => {
84 error!("unknown CoreObjectType value: {} {}", value, e);
85 Self::ErrObjType
86 }
87 }
88 }
89}
90
91impl CoreObjectType {
92 pub fn as_u16(&self) -> u16 {
93 let v: u16 = self.clone().into();
94 v
95 }
96}