havok_types/
variant.rs

1//! Variant: object pointer + class meta pointer
2use crate::Pointer;
3
4/// C++ info
5/// - type size: `   8`(x86)/` 16`(x86_64)
6///
7/// Only used for `value` of `hkCustomAttributesAttribute`.
8#[cfg_attr(feature = "json_schema", derive(schemars::JsonSchema))]
9#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
10#[derive(Debug, Clone, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
11pub struct Variant {
12    /// # C++ Info
13    /// - name: `object`(ctype: `void*`)
14    /// - offset: `  0`(x86)/`  0`(x86_64)
15    /// - type_size: `  4`(x86)/`  8`(x86_64)
16    pub object: Pointer,
17    /// # C++ Info
18    /// - name: `class`(ctype: `hkClass*`)
19    /// - offset: `  4`(x86)/`  8`(x86_64)
20    /// - type_size: `  4`(x86)/` 8`(x86_64)
21    ///
22    /// `hkClass*` is a class that holds meta-information (Flags, vtable, etc.) for each C++ Havok class and is stored in its own static field.
23    pub class: Pointer,
24}
25
26impl Variant {
27    /// Creates a new `Variant`
28    #[inline]
29    pub const fn new(object: Pointer, class: Pointer) -> Self {
30        Self { object, class }
31    }
32}