Skip to main content

luaur_ast/methods/
ast_name_table_entry_operator_eq.rs

1use crate::records::entry::Entry;
2
3#[allow(non_snake_case)]
4impl Entry {
5    pub fn operator_eq(&self, other: &Entry) -> bool {
6        if self.length != other.length {
7            return false;
8        }
9
10        if self.value.value == other.value.value {
11            return true;
12        }
13
14        unsafe {
15            core::slice::from_raw_parts(self.value.value as *const u8, self.length as usize)
16                == core::slice::from_raw_parts(
17                    other.value.value as *const u8,
18                    other.length as usize,
19                )
20        }
21    }
22}
23
24impl PartialEq for Entry {
25    fn eq(&self, other: &Self) -> bool {
26        self.operator_eq(other)
27    }
28}
29
30impl Eq for Entry {}
31
32pub fn ast_name_table_entry_operator_eq(this: &Entry, other: &Entry) -> bool {
33    this.operator_eq(other)
34}