commonlibsse_ng\re\h/
hkContainerAllocators.rs

1use crate::re::hkMemoryAllocator::hkMemoryAllocatorVtbl;
2use crate::re::offsets_rtti::RTTI_hkContainerHeapAllocator__Allocator;
3use crate::re::offsets_vtable::VTABLE_hkContainerHeapAllocator__Allocator;
4use crate::rel::id::VariantID;
5
6/// C++ classes without members.
7///
8/// Note: Inheritance of this when reproducing class inheritance in Rust types will result in an undersized class due to EBO (Empty Base Optiomization).
9///
10/// Do not use this when inheriting.
11#[repr(C)]
12pub struct hkContainerHeapAllocator {
13    // Unlike Rust, C++ has a 1-byte address even when there is no member.
14    address: u8,
15}
16const _: () = assert!(core::mem::size_of::<hkContainerHeapAllocator>() == 0x1);
17
18impl hkContainerHeapAllocator {
19    /// Gets the singleton instance of `Allocator`.
20    #[commonlibsse_ng_derive_internal::relocate(
21        cast_as = "*mut *mut Allocator",
22        default = "None",
23        deref_once,
24        id(se = 510713, ae = 383828)
25    )]
26    pub fn get_singleton() -> Option<&'static Allocator> {
27        |deref_type: DerefType| unsafe { deref_type.as_ref() }
28    }
29
30    /// Gets the mutable singleton instance of `Allocator`.
31    #[commonlibsse_ng_derive_internal::relocate(
32        cast_as = "*mut *mut Allocator",
33        default = "None",
34        deref_once,
35        id(se = 510713, ae = 383828)
36    )]
37    pub fn get_singleton_mut() -> Option<&'static mut Allocator> {
38        |deref_type: DerefType| unsafe { deref_type.as_mut() }
39    }
40}
41
42/// hkContainerHeapAllocator namespace C++ class
43#[repr(C)]
44pub struct Allocator {
45    pub vtbl: *const AllocatorVtbl,
46}
47const _: () = assert!(core::mem::size_of::<Allocator>() == 0x8);
48
49impl Allocator {
50    /// Address & offset of the runtime type information (RTTI) identifier.
51    pub const RTTI: VariantID = RTTI_hkContainerHeapAllocator__Allocator;
52    /// Address & offset of the virtual function table.
53    pub const VTABLE: [VariantID; 1] = VTABLE_hkContainerHeapAllocator__Allocator;
54}
55
56#[repr(C)]
57pub struct AllocatorVtbl {
58    pub __base: hkMemoryAllocatorVtbl,
59}