Skip to main content

steam_enums/
eudppackettype.rs

1#![allow(non_camel_case_types)]
2#![allow(non_upper_case_globals)]
3#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
4#[repr(i32)]
5pub enum EUdpPacketType {
6    Invalid = 0,
7    ChallengeReq = 1,
8    Challenge = 2,
9    Connect = 3,
10    Accept = 4,
11    Disconnect = 5,
12    Data = 6,
13    Datagram = 7,
14    Max = 8,
15}
16
17impl EUdpPacketType {
18    pub fn from_i32(val: i32) -> Option<Self> {
19        match val {
20            x if x == Self::Invalid as i32 => Some(Self::Invalid),
21            x if x == Self::ChallengeReq as i32 => Some(Self::ChallengeReq),
22            x if x == Self::Challenge as i32 => Some(Self::Challenge),
23            x if x == Self::Connect as i32 => Some(Self::Connect),
24            x if x == Self::Accept as i32 => Some(Self::Accept),
25            x if x == Self::Disconnect as i32 => Some(Self::Disconnect),
26            x if x == Self::Data as i32 => Some(Self::Data),
27            x if x == Self::Datagram as i32 => Some(Self::Datagram),
28            x if x == Self::Max as i32 => Some(Self::Max),
29            _ => None,
30        }
31    }
32}