| 1 |
use lazy_static::lazy_static; |
| 2 |
use std::collections::HashMap; |
| 3 |
|
| 4 |
#[derive(Debug, PartialEq, Eq, Clone, Copy)] |
| 5 |
pub(crate) enum FieldType { |
| 6 |
Encoded, |
| 7 |
Numeric, |
| 8 |
NumericDec, |
| 9 |
NumericHex, |
| 10 |
NumericOct, |
| 11 |
} |
| 12 |
|
| 13 |
lazy_static! { |
| 14 |
pub(crate) static ref EVENT_IDS: HashMap<&'static[u8], u32> = { |
| 15 |
let els: &[(&str, u32)] = &[ /* @EVENT_CONST@ */ ]; |
| 16 |
let mut hm = HashMap::with_capacity(els.len()); |
| 17 |
for (name, value) in els { |
| 18 |
hm.insert(name.as_bytes(), *value); |
| 19 |
} |
| 20 |
hm |
| 21 |
}; |
| 22 |
pub(crate) static ref EVENT_NAMES: HashMap<u32, &'static str> = { |
| 23 |
let els: &[(&str, u32)] = &[ /* @EVENT_CONST@ */ ]; |
| 24 |
let mut hm = HashMap::with_capacity(els.len()); |
| 25 |
for (name, value) in els { |
| 26 |
hm.insert(*value, *name); |
| 27 |
} |
| 28 |
hm |
| 29 |
}; |
| 30 |
pub(crate) static ref FIELD_TYPES: HashMap<&'static[u8],FieldType> = { |
| 31 |
let els: &[(&str, FieldType)] = &[ /* @FIELD_TYPES@ */ ]; |
| 32 |
let mut hm = HashMap::with_capacity(els.len()); |
| 33 |
for (name, typ) in els { |
| 34 |
hm.insert(name.as_bytes(), *typ); |
| 35 |
} |
| 36 |
hm |
| 37 |
}; |
| 38 |
} |