luaur_bytecode/methods/
bytecode_builder_string_ref_operator_eq.rs1use crate::records::string_ref::StringRef;
2
3impl StringRef {
4 #[allow(non_snake_case)]
5 pub(crate) fn operator_eq(&self, other: &StringRef) -> bool {
6 if !self.data.is_null() && !other.data.is_null() {
7 if self.length != other.length {
8 return false;
9 }
10 if self.length == 0 {
11 return true;
12 }
13 unsafe {
14 core::ptr::eq(self.data, other.data)
15 || (core::slice::from_raw_parts(self.data as *const u8, self.length)
16 == core::slice::from_raw_parts(other.data as *const u8, other.length))
17 }
18 } else {
19 self.data == other.data
20 }
21 }
22}