luaur_bytecode/records/
bc_imm.rs1use crate::enums::bc_imm_kind::BcImmKind;
2
3#[repr(C)]
4#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
5pub struct BcImm {
6 pub kind: BcImmKind,
7 pub value: BcImmValue,
8}
9
10#[repr(C)]
11#[derive(Copy, Clone)]
12pub union BcImmValue {
13 pub valueBoolean: bool,
14 pub valueInt: i32,
15 pub valueImport: u32,
16}
17
18impl std::fmt::Debug for BcImmValue {
19 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
20 f.debug_struct("BcImmValue").finish_non_exhaustive()
21 }
22}
23
24impl PartialEq for BcImmValue {
25 fn eq(&self, _other: &Self) -> bool {
26 unsafe { self.valueImport == _other.valueImport }
28 }
29}
30
31impl Eq for BcImmValue {}
32
33impl std::hash::Hash for BcImmValue {
34 fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
35 unsafe { self.valueImport.hash(state) }
36 }
37}