havok_classes/generated/
hkContactPoint_.rs

1use super::class_requires::*;
2use super::*;
3/// # C++ Info
4/// - name: `hkContactPoint`
5/// - version: `0`
6/// - signature: `0x91d7dd8e`
7/// - size: ` 32`(x86)/` 32`(x86_64)
8/// -  vtable: `false`
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 hkContactPoint {
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    /// # C++ Info
27    /// - name: `position`(ctype: `hkVector4`)
28    /// - offset: `  0`(x86)/`  0`(x86_64)
29    /// - type_size: ` 16`(x86)/` 16`(x86_64)
30    #[cfg_attr(feature = "json_schema", schemars(rename = "position"))]
31    #[cfg_attr(feature = "serde", serde(rename = "position"))]
32    pub m_position: Vector4,
33    /// # C++ Info
34    /// - name: `separatingNormal`(ctype: `hkVector4`)
35    /// - offset: ` 16`(x86)/` 16`(x86_64)
36    /// - type_size: ` 16`(x86)/` 16`(x86_64)
37    #[cfg_attr(feature = "json_schema", schemars(rename = "separatingNormal"))]
38    #[cfg_attr(feature = "serde", serde(rename = "separatingNormal"))]
39    pub m_separatingNormal: Vector4,
40}
41const _: () = {
42    use havok_serde as _serde;
43    impl _serde::HavokClass for hkContactPoint {
44        #[inline]
45        fn name(&self) -> &'static str {
46            "hkContactPoint"
47        }
48        #[inline]
49        fn signature(&self) -> _serde::__private::Signature {
50            _serde::__private::Signature::new(0x91d7dd8e)
51        }
52        #[allow(clippy::let_and_return, clippy::vec_init_then_push)]
53        fn deps_indexes(&self) -> Vec<usize> {
54            let mut v = Vec::new();
55            v
56        }
57    }
58    impl _serde::Serialize for hkContactPoint {
59        fn serialize<S>(&self, __serializer: S) -> Result<S::Ok, S::Error>
60        where
61            S: _serde::ser::Serializer,
62        {
63            let class_meta = self
64                .__ptr
65                .map(|name| (name, _serde::__private::Signature::new(0x91d7dd8e)));
66            let mut serializer = __serializer
67                .serialize_struct("hkContactPoint", class_meta, (32u64, 32u64))?;
68            serializer.serialize_field("position", &self.m_position)?;
69            serializer.serialize_field("separatingNormal", &self.m_separatingNormal)?;
70            serializer.end()
71        }
72    }
73};
74#[doc(hidden)]
75#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
76const _: () = {
77    use havok_serde as _serde;
78    #[automatically_derived]
79    impl<'de> _serde::Deserialize<'de> for hkContactPoint {
80        fn deserialize<__D>(deserializer: __D) -> core::result::Result<Self, __D::Error>
81        where
82            __D: _serde::Deserializer<'de>,
83        {
84            #[allow(non_camel_case_types)]
85            enum __Field {
86                m_position,
87                m_separatingNormal,
88                __ignore,
89            }
90            struct __FieldVisitor;
91            impl<'de> _serde::de::Visitor<'de> for __FieldVisitor {
92                type Value = __Field;
93                fn expecting(
94                    &self,
95                    __formatter: &mut core::fmt::Formatter,
96                ) -> core::fmt::Result {
97                    core::fmt::Formatter::write_str(__formatter, "field identifier")
98                }
99                /// Intended for use in XML.
100                #[allow(clippy::match_single_binding)]
101                #[allow(clippy::reversed_empty_ranges)]
102                #[allow(clippy::single_match)]
103                fn visit_key<__E>(
104                    self,
105                    __value: &str,
106                ) -> core::result::Result<Self::Value, __E>
107                where
108                    __E: _serde::de::Error,
109                {
110                    match __value {
111                        "position" => Ok(__Field::m_position),
112                        "separatingNormal" => Ok(__Field::m_separatingNormal),
113                        _ => Ok(__Field::__ignore),
114                    }
115                }
116            }
117            impl<'de> _serde::Deserialize<'de> for __Field {
118                #[inline]
119                fn deserialize<__D>(
120                    __deserializer: __D,
121                ) -> core::result::Result<Self, __D::Error>
122                where
123                    __D: _serde::Deserializer<'de>,
124                {
125                    _serde::Deserializer::deserialize_key(__deserializer, __FieldVisitor)
126                }
127            }
128            struct __hkContactPointVisitor<'de> {
129                marker: _serde::__private::PhantomData<hkContactPoint>,
130                lifetime: _serde::__private::PhantomData<&'de ()>,
131            }
132            #[allow(clippy::match_single_binding)]
133            #[allow(clippy::reversed_empty_ranges)]
134            #[allow(clippy::single_match)]
135            impl<'de> _serde::de::Visitor<'de> for __hkContactPointVisitor<'de> {
136                type Value = hkContactPoint;
137                fn expecting(
138                    &self,
139                    __formatter: &mut core::fmt::Formatter,
140                ) -> core::fmt::Result {
141                    core::fmt::Formatter::write_str(__formatter, "struct hkContactPoint")
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 mut m_position: _serde::__private::Option<Vector4> = _serde::__private::None;
152                    let mut m_separatingNormal: _serde::__private::Option<Vector4> = _serde::__private::None;
153                    for i in 0..2usize {
154                        match i {
155                            0usize => {
156                                if _serde::__private::Option::is_some(&m_position) {
157                                    return _serde::__private::Err(
158                                        <__A::Error as _serde::de::Error>::duplicate_field(
159                                            "position",
160                                        ),
161                                    );
162                                }
163                                m_position = _serde::__private::Some(
164                                    match __A::next_value::<Vector4>(&mut __map) {
165                                        _serde::__private::Ok(__val) => __val,
166                                        _serde::__private::Err(__err) => {
167                                            return _serde::__private::Err(__err);
168                                        }
169                                    },
170                                );
171                            }
172                            1usize => {
173                                if _serde::__private::Option::is_some(&m_separatingNormal) {
174                                    return _serde::__private::Err(
175                                        <__A::Error as _serde::de::Error>::duplicate_field(
176                                            "separatingNormal",
177                                        ),
178                                    );
179                                }
180                                m_separatingNormal = _serde::__private::Some(
181                                    match __A::next_value::<Vector4>(&mut __map) {
182                                        _serde::__private::Ok(__val) => __val,
183                                        _serde::__private::Err(__err) => {
184                                            return _serde::__private::Err(__err);
185                                        }
186                                    },
187                                );
188                            }
189                            _ => {}
190                        }
191                    }
192                    let m_position = match m_position {
193                        _serde::__private::Some(__field) => __field,
194                        _serde::__private::None => {
195                            return _serde::__private::Err(
196                                <__A::Error as _serde::de::Error>::missing_field("position"),
197                            );
198                        }
199                    };
200                    let m_separatingNormal = match m_separatingNormal {
201                        _serde::__private::Some(__field) => __field,
202                        _serde::__private::None => {
203                            return _serde::__private::Err(
204                                <__A::Error as _serde::de::Error>::missing_field(
205                                    "separatingNormal",
206                                ),
207                            );
208                        }
209                    };
210                    _serde::__private::Ok(hkContactPoint {
211                        __ptr,
212                        m_position,
213                        m_separatingNormal,
214                    })
215                }
216                #[allow(clippy::manual_unwrap_or_default)]
217                fn visit_struct<__A>(
218                    self,
219                    mut __map: __A,
220                ) -> _serde::__private::Result<Self::Value, __A::Error>
221                where
222                    __A: _serde::de::MapAccess<'de>,
223                {
224                    let mut m_position: _serde::__private::Option<Vector4> = _serde::__private::None;
225                    let mut m_separatingNormal: _serde::__private::Option<Vector4> = _serde::__private::None;
226                    while let _serde::__private::Some(__key) = {
227                        __A::next_key::<__Field>(&mut __map)?
228                    } {
229                        match __key {
230                            __Field::m_position => {
231                                #[cfg(
232                                    any(feature = "strict", feature = "ignore_duplicates")
233                                )]
234                                if _serde::__private::Option::is_some(&m_position) {
235                                    #[cfg(feature = "ignore_duplicates")]
236                                    {
237                                        __A::skip_value(&mut __map)?;
238                                        continue;
239                                    }
240                                    #[cfg(feature = "strict")]
241                                    return _serde::__private::Err(
242                                        <__A::Error as _serde::de::Error>::duplicate_field(
243                                            "position",
244                                        ),
245                                    );
246                                }
247                                m_position = _serde::__private::Some(
248                                    match __A::next_value::<Vector4>(&mut __map) {
249                                        _serde::__private::Ok(__val) => __val,
250                                        _serde::__private::Err(__err) => {
251                                            return _serde::__private::Err(__err);
252                                        }
253                                    },
254                                );
255                            }
256                            __Field::m_separatingNormal => {
257                                #[cfg(
258                                    any(feature = "strict", feature = "ignore_duplicates")
259                                )]
260                                if _serde::__private::Option::is_some(&m_separatingNormal) {
261                                    #[cfg(feature = "ignore_duplicates")]
262                                    {
263                                        __A::skip_value(&mut __map)?;
264                                        continue;
265                                    }
266                                    #[cfg(feature = "strict")]
267                                    return _serde::__private::Err(
268                                        <__A::Error as _serde::de::Error>::duplicate_field(
269                                            "separatingNormal",
270                                        ),
271                                    );
272                                }
273                                m_separatingNormal = _serde::__private::Some(
274                                    match __A::next_value::<Vector4>(&mut __map) {
275                                        _serde::__private::Ok(__val) => __val,
276                                        _serde::__private::Err(__err) => {
277                                            return _serde::__private::Err(__err);
278                                        }
279                                    },
280                                );
281                            }
282                            _ => __A::skip_value(&mut __map)?,
283                        }
284                    }
285                    let m_position = match m_position {
286                        _serde::__private::Some(__field) => __field,
287                        _serde::__private::None => {
288                            #[cfg(feature = "strict")]
289                            return _serde::__private::Err(
290                                <__A::Error as _serde::de::Error>::missing_field("position"),
291                            );
292                            #[cfg(not(feature = "strict"))] Default::default()
293                        }
294                    };
295                    let m_separatingNormal = match m_separatingNormal {
296                        _serde::__private::Some(__field) => __field,
297                        _serde::__private::None => {
298                            #[cfg(feature = "strict")]
299                            return _serde::__private::Err(
300                                <__A::Error as _serde::de::Error>::missing_field(
301                                    "separatingNormal",
302                                ),
303                            );
304                            #[cfg(not(feature = "strict"))] Default::default()
305                        }
306                    };
307                    let __ptr = __A::class_ptr(&mut __map);
308                    _serde::__private::Ok(hkContactPoint {
309                        __ptr,
310                        m_position,
311                        m_separatingNormal,
312                    })
313                }
314            }
315            const FIELDS: &[&str] = &["position", "separatingNormal"];
316            _serde::Deserializer::deserialize_struct(
317                deserializer,
318                "hkContactPoint",
319                FIELDS,
320                __hkContactPointVisitor {
321                    marker: _serde::__private::PhantomData::<hkContactPoint>,
322                    lifetime: _serde::__private::PhantomData,
323                },
324            )
325        }
326    }
327};