steam-enums 0.1.0

Steam protocol enumerations (EResult, EMsg, EAccountType, etc.) for Rust.
Documentation
#![allow(non_camel_case_types)]
#![allow(non_upper_case_globals)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[repr(i32)]
pub enum EWeaponType {
    Knife = 0,
    Pistol = 1,
    SubMachineGun = 2,
    Rifle = 3,
    Shotgun = 4,
    SniperRifle = 5,
    MachineGun = 6,
    C4 = 7,
    Grenade = 8,
    Equipment = 9,
    StackableItem = 10,
    Unknown = 11,
}

impl EWeaponType {
    pub fn from_i32(val: i32) -> Option<Self> {
        match val {
            x if x == Self::Knife as i32 => Some(Self::Knife),
            x if x == Self::Pistol as i32 => Some(Self::Pistol),
            x if x == Self::SubMachineGun as i32 => Some(Self::SubMachineGun),
            x if x == Self::Rifle as i32 => Some(Self::Rifle),
            x if x == Self::Shotgun as i32 => Some(Self::Shotgun),
            x if x == Self::SniperRifle as i32 => Some(Self::SniperRifle),
            x if x == Self::MachineGun as i32 => Some(Self::MachineGun),
            x if x == Self::C4 as i32 => Some(Self::C4),
            x if x == Self::Grenade as i32 => Some(Self::Grenade),
            x if x == Self::Equipment as i32 => Some(Self::Equipment),
            x if x == Self::StackableItem as i32 => Some(Self::StackableItem),
            x if x == Self::Unknown as i32 => Some(Self::Unknown),
            _ => None,
        }
    }
}