pub trait HasVtable {
// Required method
fn vtable_ptr(&self) -> *const *const c_void;
// Provided method
fn get_virtual_function(&self, index: usize) -> *const c_void { ... }
}Expand description
Declares a type as having a C++ virtual function table. Structs that implement this trait should only ever exist as pointers/references from the game itself. They should never be instantiated directly.
This trait can be implemented with a derive
ⓘ
#[derive(forge::HasVtable)]
pub struct MyStruct;Required Methods§
fn vtable_ptr(&self) -> *const *const c_void
Provided Methods§
fn get_virtual_function(&self, index: usize) -> *const c_void
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".