1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use crate::{raw, Il2CppReflectionType, Type, WrapRaw};
pub trait Generics {
const COUNT: usize;
fn type_array() -> &'static mut raw::Il2CppArray;
}
impl<T: Type> Generics for T {
const COUNT: usize = 1;
fn type_array() -> &'static mut raw::Il2CppArray {
let arr = unsafe { raw::array_new(Il2CppReflectionType::class().raw(), 1) }.unwrap();
unsafe {
(((arr as *mut _ as isize) + (raw::kIl2CppSizeOfArray as isize))
as *mut &Il2CppReflectionType)
.write_unaligned(T::class().ty().reflection_object());
}
arr
}
}