havok_classes/generated/
hkpSingleShapeContainer_.rs

1use super::class_requires::*;
2use super::*;
3/// # C++ Info
4/// - name: `hkpSingleShapeContainer`
5/// - version: `0`
6/// - signature: `0x73aa1d38`
7/// - size: `  8`(x86)/` 16`(x86_64)
8/// -  vtable: `true`
9#[allow(non_upper_case_globals, non_snake_case)]
10#[cfg_attr(feature = "json_schema", derive(schemars::JsonSchema))]
11#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
12#[derive(educe::Educe)]
13#[educe(Debug, Clone, Default, PartialEq)]
14pub struct hkpSingleShapeContainer {
15    /// # Unique index for this class
16    /// - Represents a pointer on XML (`<hkobject name="#0001"></hkobject>`)
17    /// - [`Option::None`] => This class is `class in field`.(`<hkobject></hkobject>`)
18    ///
19    /// # Note
20    /// Not present in the binary & Not exist actual C++ field.
21    #[cfg_attr(
22        feature = "serde",
23        serde(skip_serializing_if = "Option::is_none", default)
24    )]
25    pub __ptr: Option<Pointer>,
26    /// Alternative to C++ class inheritance.
27    #[cfg_attr(feature = "json_schema", schemars(flatten))]
28    #[cfg_attr(feature = "serde", serde(flatten))]
29    pub parent: hkpShapeContainer,
30    /// # C++ Info
31    /// - name: `childShape`(ctype: `struct hkpShape*`)
32    /// - offset: `  4`(x86)/`  8`(x86_64)
33    /// - type_size: `  4`(x86)/`  8`(x86_64)
34    #[cfg_attr(feature = "json_schema", schemars(rename = "childShape"))]
35    #[cfg_attr(feature = "serde", serde(rename = "childShape"))]
36    pub m_childShape: Pointer,
37}
38const _: () = {
39    use havok_serde as _serde;
40    impl _serde::HavokClass for hkpSingleShapeContainer {
41        #[inline]
42        fn name(&self) -> &'static str {
43            "hkpSingleShapeContainer"
44        }
45        #[inline]
46        fn signature(&self) -> _serde::__private::Signature {
47            _serde::__private::Signature::new(0x73aa1d38)
48        }
49        #[allow(clippy::let_and_return, clippy::vec_init_then_push)]
50        fn deps_indexes(&self) -> Vec<usize> {
51            let mut v = Vec::new();
52            v.push(self.m_childShape.get());
53            v
54        }
55    }
56    impl _serde::Serialize for hkpSingleShapeContainer {
57        fn serialize<S>(&self, __serializer: S) -> Result<S::Ok, S::Error>
58        where
59            S: _serde::ser::Serializer,
60        {
61            let class_meta = self
62                .__ptr
63                .map(|name| (name, _serde::__private::Signature::new(0x73aa1d38)));
64            let mut serializer = __serializer
65                .serialize_struct("hkpSingleShapeContainer", class_meta, (8u64, 16u64))?;
66            serializer.pad_field([0u8; 4usize].as_slice(), [0u8; 8usize].as_slice())?;
67            serializer.serialize_field("childShape", &self.m_childShape)?;
68            serializer.end()
69        }
70    }
71};
72#[doc(hidden)]
73#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
74const _: () = {
75    use havok_serde as _serde;
76    #[automatically_derived]
77    impl<'de> _serde::Deserialize<'de> for hkpSingleShapeContainer {
78        fn deserialize<__D>(deserializer: __D) -> core::result::Result<Self, __D::Error>
79        where
80            __D: _serde::Deserializer<'de>,
81        {
82            #[allow(non_camel_case_types)]
83            enum __Field {
84                m_childShape,
85                __ignore,
86            }
87            struct __FieldVisitor;
88            impl<'de> _serde::de::Visitor<'de> for __FieldVisitor {
89                type Value = __Field;
90                fn expecting(
91                    &self,
92                    __formatter: &mut core::fmt::Formatter,
93                ) -> core::fmt::Result {
94                    core::fmt::Formatter::write_str(__formatter, "field identifier")
95                }
96                /// Intended for use in XML.
97                #[allow(clippy::match_single_binding)]
98                #[allow(clippy::reversed_empty_ranges)]
99                #[allow(clippy::single_match)]
100                fn visit_key<__E>(
101                    self,
102                    __value: &str,
103                ) -> core::result::Result<Self::Value, __E>
104                where
105                    __E: _serde::de::Error,
106                {
107                    match __value {
108                        "childShape" => Ok(__Field::m_childShape),
109                        _ => Ok(__Field::__ignore),
110                    }
111                }
112            }
113            impl<'de> _serde::Deserialize<'de> for __Field {
114                #[inline]
115                fn deserialize<__D>(
116                    __deserializer: __D,
117                ) -> core::result::Result<Self, __D::Error>
118                where
119                    __D: _serde::Deserializer<'de>,
120                {
121                    _serde::Deserializer::deserialize_key(__deserializer, __FieldVisitor)
122                }
123            }
124            struct __hkpSingleShapeContainerVisitor<'de> {
125                marker: _serde::__private::PhantomData<hkpSingleShapeContainer>,
126                lifetime: _serde::__private::PhantomData<&'de ()>,
127            }
128            #[allow(clippy::match_single_binding)]
129            #[allow(clippy::reversed_empty_ranges)]
130            #[allow(clippy::single_match)]
131            impl<'de> _serde::de::Visitor<'de>
132            for __hkpSingleShapeContainerVisitor<'de> {
133                type Value = hkpSingleShapeContainer;
134                fn expecting(
135                    &self,
136                    __formatter: &mut core::fmt::Formatter,
137                ) -> core::fmt::Result {
138                    core::fmt::Formatter::write_str(
139                        __formatter,
140                        "struct hkpSingleShapeContainer",
141                    )
142                }
143                fn visit_struct_for_bytes<__A>(
144                    self,
145                    mut __map: __A,
146                ) -> _serde::__private::Result<Self::Value, __A::Error>
147                where
148                    __A: _serde::de::MapAccess<'de>,
149                {
150                    let __ptr = __A::class_ptr(&mut __map);
151                    let parent = __A::parent_value(&mut __map)?;
152                    let mut m_childShape: _serde::__private::Option<Pointer> = _serde::__private::None;
153                    for i in 0..1usize {
154                        match i {
155                            0usize => {
156                                if _serde::__private::Option::is_some(&m_childShape) {
157                                    return _serde::__private::Err(
158                                        <__A::Error as _serde::de::Error>::duplicate_field(
159                                            "childShape",
160                                        ),
161                                    );
162                                }
163                                m_childShape = _serde::__private::Some(
164                                    match __A::next_value::<Pointer>(&mut __map) {
165                                        _serde::__private::Ok(__val) => __val,
166                                        _serde::__private::Err(__err) => {
167                                            return _serde::__private::Err(__err);
168                                        }
169                                    },
170                                );
171                            }
172                            _ => {}
173                        }
174                    }
175                    let m_childShape = match m_childShape {
176                        _serde::__private::Some(__field) => __field,
177                        _serde::__private::None => {
178                            return _serde::__private::Err(
179                                <__A::Error as _serde::de::Error>::missing_field(
180                                    "childShape",
181                                ),
182                            );
183                        }
184                    };
185                    _serde::__private::Ok(hkpSingleShapeContainer {
186                        __ptr,
187                        parent,
188                        m_childShape,
189                    })
190                }
191                #[allow(clippy::manual_unwrap_or_default)]
192                fn visit_struct<__A>(
193                    self,
194                    mut __map: __A,
195                ) -> _serde::__private::Result<Self::Value, __A::Error>
196                where
197                    __A: _serde::de::MapAccess<'de>,
198                {
199                    let mut m_childShape: _serde::__private::Option<Pointer> = _serde::__private::None;
200                    while let _serde::__private::Some(__key) = {
201                        __A::next_key::<__Field>(&mut __map)?
202                    } {
203                        match __key {
204                            __Field::m_childShape => {
205                                #[cfg(
206                                    any(feature = "strict", feature = "ignore_duplicates")
207                                )]
208                                if _serde::__private::Option::is_some(&m_childShape) {
209                                    #[cfg(feature = "ignore_duplicates")]
210                                    {
211                                        __A::skip_value(&mut __map)?;
212                                        continue;
213                                    }
214                                    #[cfg(feature = "strict")]
215                                    return _serde::__private::Err(
216                                        <__A::Error as _serde::de::Error>::duplicate_field(
217                                            "childShape",
218                                        ),
219                                    );
220                                }
221                                m_childShape = _serde::__private::Some(
222                                    match __A::next_value::<Pointer>(&mut __map) {
223                                        _serde::__private::Ok(__val) => __val,
224                                        _serde::__private::Err(__err) => {
225                                            return _serde::__private::Err(__err);
226                                        }
227                                    },
228                                );
229                            }
230                            _ => __A::skip_value(&mut __map)?,
231                        }
232                    }
233                    let m_childShape = match m_childShape {
234                        _serde::__private::Some(__field) => __field,
235                        _serde::__private::None => {
236                            #[cfg(feature = "strict")]
237                            return _serde::__private::Err(
238                                <__A::Error as _serde::de::Error>::missing_field(
239                                    "childShape",
240                                ),
241                            );
242                            #[cfg(not(feature = "strict"))] Default::default()
243                        }
244                    };
245                    let __ptr = None;
246                    let parent = hkpShapeContainer { __ptr };
247                    let __ptr = __A::class_ptr(&mut __map);
248                    _serde::__private::Ok(hkpSingleShapeContainer {
249                        __ptr,
250                        parent,
251                        m_childShape,
252                    })
253                }
254            }
255            const FIELDS: &[&str] = &["childShape"];
256            _serde::Deserializer::deserialize_struct(
257                deserializer,
258                "hkpSingleShapeContainer",
259                FIELDS,
260                __hkpSingleShapeContainerVisitor {
261                    marker: _serde::__private::PhantomData::<hkpSingleShapeContainer>,
262                    lifetime: _serde::__private::PhantomData,
263                },
264            )
265        }
266    }
267};