Skip to main content

steam_enums/
eregioncode.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 ERegionCode {
6    USEast = 0x00,
7    USWest = 0x01,
8    SouthAmerica = 0x02,
9    Europe = 0x03,
10    Asia = 0x04,
11    Australia = 0x05,
12    MiddleEast = 0x06,
13    Africa = 0x07,
14    World = 0xFF,
15}
16
17impl ERegionCode {
18    pub fn from_i32(val: i32) -> Option<Self> {
19        match val {
20            x if x == Self::USEast as i32 => Some(Self::USEast),
21            x if x == Self::USWest as i32 => Some(Self::USWest),
22            x if x == Self::SouthAmerica as i32 => Some(Self::SouthAmerica),
23            x if x == Self::Europe as i32 => Some(Self::Europe),
24            x if x == Self::Asia as i32 => Some(Self::Asia),
25            x if x == Self::Australia as i32 => Some(Self::Australia),
26            x if x == Self::MiddleEast as i32 => Some(Self::MiddleEast),
27            x if x == Self::Africa as i32 => Some(Self::Africa),
28            x if x == Self::World as i32 => Some(Self::World),
29            _ => None,
30        }
31    }
32}