havok_classes/generated/
hkContactPointMaterial_.rs

1use super::class_requires::*;
2use super::*;
3/// # C++ Info
4/// - name: `hkContactPointMaterial`
5/// - version: `0`
6/// - signature: `0x4e32287c`
7/// - size: `  8`(x86)/` 16`(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 hkContactPointMaterial {
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: `userData`(ctype: `hkUlong`)
28    /// - offset: `  0`(x86)/`  0`(x86_64)
29    /// - type_size: `  4`(x86)/`  8`(x86_64)
30    #[cfg_attr(feature = "json_schema", schemars(rename = "userData"))]
31    #[cfg_attr(feature = "serde", serde(rename = "userData"))]
32    pub m_userData: Ulong,
33    /// # C++ Info
34    /// - name: `friction`(ctype: `hkUint8`)
35    /// - offset: `  4`(x86)/`  8`(x86_64)
36    /// - type_size: `  1`(x86)/`  1`(x86_64)
37    #[cfg_attr(feature = "json_schema", schemars(rename = "friction"))]
38    #[cfg_attr(feature = "serde", serde(rename = "friction"))]
39    pub m_friction: u8,
40    /// # C++ Info
41    /// - name: `restitution`(ctype: `hkUint8`)
42    /// - offset: `  5`(x86)/`  9`(x86_64)
43    /// - type_size: `  1`(x86)/`  1`(x86_64)
44    #[cfg_attr(feature = "json_schema", schemars(rename = "restitution"))]
45    #[cfg_attr(feature = "serde", serde(rename = "restitution"))]
46    pub m_restitution: u8,
47    /// # C++ Info
48    /// - name: `maxImpulse`(ctype: `hkUint8`)
49    /// - offset: `  6`(x86)/` 10`(x86_64)
50    /// - type_size: `  1`(x86)/`  1`(x86_64)
51    #[cfg_attr(feature = "json_schema", schemars(rename = "maxImpulse"))]
52    #[cfg_attr(feature = "serde", serde(rename = "maxImpulse"))]
53    pub m_maxImpulse: u8,
54    /// # C++ Info
55    /// - name: `flags`(ctype: `hkUint8`)
56    /// - offset: `  7`(x86)/` 11`(x86_64)
57    /// - type_size: `  1`(x86)/`  1`(x86_64)
58    #[cfg_attr(feature = "json_schema", schemars(rename = "flags"))]
59    #[cfg_attr(feature = "serde", serde(rename = "flags"))]
60    pub m_flags: u8,
61}
62const _: () = {
63    use havok_serde as _serde;
64    impl _serde::HavokClass for hkContactPointMaterial {
65        #[inline]
66        fn name(&self) -> &'static str {
67            "hkContactPointMaterial"
68        }
69        #[inline]
70        fn signature(&self) -> _serde::__private::Signature {
71            _serde::__private::Signature::new(0x4e32287c)
72        }
73        #[allow(clippy::let_and_return, clippy::vec_init_then_push)]
74        fn deps_indexes(&self) -> Vec<usize> {
75            let mut v = Vec::new();
76            v
77        }
78    }
79    impl _serde::Serialize for hkContactPointMaterial {
80        fn serialize<S>(&self, __serializer: S) -> Result<S::Ok, S::Error>
81        where
82            S: _serde::ser::Serializer,
83        {
84            let class_meta = self
85                .__ptr
86                .map(|name| (name, _serde::__private::Signature::new(0x4e32287c)));
87            let mut serializer = __serializer
88                .serialize_struct("hkContactPointMaterial", class_meta, (8u64, 16u64))?;
89            serializer.serialize_field("userData", &self.m_userData)?;
90            serializer.serialize_field("friction", &self.m_friction)?;
91            serializer.serialize_field("restitution", &self.m_restitution)?;
92            serializer.serialize_field("maxImpulse", &self.m_maxImpulse)?;
93            serializer.serialize_field("flags", &self.m_flags)?;
94            serializer.pad_field([0u8; 0usize].as_slice(), [0u8; 4usize].as_slice())?;
95            serializer.end()
96        }
97    }
98};
99#[doc(hidden)]
100#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
101const _: () = {
102    use havok_serde as _serde;
103    #[automatically_derived]
104    impl<'de> _serde::Deserialize<'de> for hkContactPointMaterial {
105        fn deserialize<__D>(deserializer: __D) -> core::result::Result<Self, __D::Error>
106        where
107            __D: _serde::Deserializer<'de>,
108        {
109            #[allow(non_camel_case_types)]
110            enum __Field {
111                m_userData,
112                m_friction,
113                m_restitution,
114                m_maxImpulse,
115                m_flags,
116                __ignore,
117            }
118            struct __FieldVisitor;
119            impl<'de> _serde::de::Visitor<'de> for __FieldVisitor {
120                type Value = __Field;
121                fn expecting(
122                    &self,
123                    __formatter: &mut core::fmt::Formatter,
124                ) -> core::fmt::Result {
125                    core::fmt::Formatter::write_str(__formatter, "field identifier")
126                }
127                /// Intended for use in XML.
128                #[allow(clippy::match_single_binding)]
129                #[allow(clippy::reversed_empty_ranges)]
130                #[allow(clippy::single_match)]
131                fn visit_key<__E>(
132                    self,
133                    __value: &str,
134                ) -> core::result::Result<Self::Value, __E>
135                where
136                    __E: _serde::de::Error,
137                {
138                    match __value {
139                        "userData" => Ok(__Field::m_userData),
140                        "friction" => Ok(__Field::m_friction),
141                        "restitution" => Ok(__Field::m_restitution),
142                        "maxImpulse" => Ok(__Field::m_maxImpulse),
143                        "flags" => Ok(__Field::m_flags),
144                        _ => Ok(__Field::__ignore),
145                    }
146                }
147            }
148            impl<'de> _serde::Deserialize<'de> for __Field {
149                #[inline]
150                fn deserialize<__D>(
151                    __deserializer: __D,
152                ) -> core::result::Result<Self, __D::Error>
153                where
154                    __D: _serde::Deserializer<'de>,
155                {
156                    _serde::Deserializer::deserialize_key(__deserializer, __FieldVisitor)
157                }
158            }
159            struct __hkContactPointMaterialVisitor<'de> {
160                marker: _serde::__private::PhantomData<hkContactPointMaterial>,
161                lifetime: _serde::__private::PhantomData<&'de ()>,
162            }
163            #[allow(clippy::match_single_binding)]
164            #[allow(clippy::reversed_empty_ranges)]
165            #[allow(clippy::single_match)]
166            impl<'de> _serde::de::Visitor<'de> for __hkContactPointMaterialVisitor<'de> {
167                type Value = hkContactPointMaterial;
168                fn expecting(
169                    &self,
170                    __formatter: &mut core::fmt::Formatter,
171                ) -> core::fmt::Result {
172                    core::fmt::Formatter::write_str(
173                        __formatter,
174                        "struct hkContactPointMaterial",
175                    )
176                }
177                fn visit_struct_for_bytes<__A>(
178                    self,
179                    mut __map: __A,
180                ) -> _serde::__private::Result<Self::Value, __A::Error>
181                where
182                    __A: _serde::de::MapAccess<'de>,
183                {
184                    let __ptr = __A::class_ptr(&mut __map);
185                    let mut m_userData: _serde::__private::Option<Ulong> = _serde::__private::None;
186                    let mut m_friction: _serde::__private::Option<u8> = _serde::__private::None;
187                    let mut m_restitution: _serde::__private::Option<u8> = _serde::__private::None;
188                    let mut m_maxImpulse: _serde::__private::Option<u8> = _serde::__private::None;
189                    let mut m_flags: _serde::__private::Option<u8> = _serde::__private::None;
190                    for i in 0..5usize {
191                        match i {
192                            0usize => {
193                                if _serde::__private::Option::is_some(&m_userData) {
194                                    return _serde::__private::Err(
195                                        <__A::Error as _serde::de::Error>::duplicate_field(
196                                            "userData",
197                                        ),
198                                    );
199                                }
200                                m_userData = _serde::__private::Some(
201                                    match __A::next_value::<Ulong>(&mut __map) {
202                                        _serde::__private::Ok(__val) => __val,
203                                        _serde::__private::Err(__err) => {
204                                            return _serde::__private::Err(__err);
205                                        }
206                                    },
207                                );
208                            }
209                            1usize => {
210                                if _serde::__private::Option::is_some(&m_friction) {
211                                    return _serde::__private::Err(
212                                        <__A::Error as _serde::de::Error>::duplicate_field(
213                                            "friction",
214                                        ),
215                                    );
216                                }
217                                m_friction = _serde::__private::Some(
218                                    match __A::next_value::<u8>(&mut __map) {
219                                        _serde::__private::Ok(__val) => __val,
220                                        _serde::__private::Err(__err) => {
221                                            return _serde::__private::Err(__err);
222                                        }
223                                    },
224                                );
225                            }
226                            2usize => {
227                                if _serde::__private::Option::is_some(&m_restitution) {
228                                    return _serde::__private::Err(
229                                        <__A::Error as _serde::de::Error>::duplicate_field(
230                                            "restitution",
231                                        ),
232                                    );
233                                }
234                                m_restitution = _serde::__private::Some(
235                                    match __A::next_value::<u8>(&mut __map) {
236                                        _serde::__private::Ok(__val) => __val,
237                                        _serde::__private::Err(__err) => {
238                                            return _serde::__private::Err(__err);
239                                        }
240                                    },
241                                );
242                            }
243                            3usize => {
244                                if _serde::__private::Option::is_some(&m_maxImpulse) {
245                                    return _serde::__private::Err(
246                                        <__A::Error as _serde::de::Error>::duplicate_field(
247                                            "maxImpulse",
248                                        ),
249                                    );
250                                }
251                                m_maxImpulse = _serde::__private::Some(
252                                    match __A::next_value::<u8>(&mut __map) {
253                                        _serde::__private::Ok(__val) => __val,
254                                        _serde::__private::Err(__err) => {
255                                            return _serde::__private::Err(__err);
256                                        }
257                                    },
258                                );
259                            }
260                            4usize => {
261                                if _serde::__private::Option::is_some(&m_flags) {
262                                    return _serde::__private::Err(
263                                        <__A::Error as _serde::de::Error>::duplicate_field("flags"),
264                                    );
265                                }
266                                m_flags = _serde::__private::Some(
267                                    match __A::next_value::<u8>(&mut __map) {
268                                        _serde::__private::Ok(__val) => __val,
269                                        _serde::__private::Err(__err) => {
270                                            return _serde::__private::Err(__err);
271                                        }
272                                    },
273                                );
274                            }
275                            _ => {}
276                        }
277                    }
278                    __A::pad(&mut __map, 0usize, 4usize)?;
279                    let m_userData = match m_userData {
280                        _serde::__private::Some(__field) => __field,
281                        _serde::__private::None => {
282                            return _serde::__private::Err(
283                                <__A::Error as _serde::de::Error>::missing_field("userData"),
284                            );
285                        }
286                    };
287                    let m_friction = match m_friction {
288                        _serde::__private::Some(__field) => __field,
289                        _serde::__private::None => {
290                            return _serde::__private::Err(
291                                <__A::Error as _serde::de::Error>::missing_field("friction"),
292                            );
293                        }
294                    };
295                    let m_restitution = match m_restitution {
296                        _serde::__private::Some(__field) => __field,
297                        _serde::__private::None => {
298                            return _serde::__private::Err(
299                                <__A::Error as _serde::de::Error>::missing_field(
300                                    "restitution",
301                                ),
302                            );
303                        }
304                    };
305                    let m_maxImpulse = match m_maxImpulse {
306                        _serde::__private::Some(__field) => __field,
307                        _serde::__private::None => {
308                            return _serde::__private::Err(
309                                <__A::Error as _serde::de::Error>::missing_field(
310                                    "maxImpulse",
311                                ),
312                            );
313                        }
314                    };
315                    let m_flags = match m_flags {
316                        _serde::__private::Some(__field) => __field,
317                        _serde::__private::None => {
318                            return _serde::__private::Err(
319                                <__A::Error as _serde::de::Error>::missing_field("flags"),
320                            );
321                        }
322                    };
323                    _serde::__private::Ok(hkContactPointMaterial {
324                        __ptr,
325                        m_userData,
326                        m_friction,
327                        m_restitution,
328                        m_maxImpulse,
329                        m_flags,
330                    })
331                }
332                #[allow(clippy::manual_unwrap_or_default)]
333                fn visit_struct<__A>(
334                    self,
335                    mut __map: __A,
336                ) -> _serde::__private::Result<Self::Value, __A::Error>
337                where
338                    __A: _serde::de::MapAccess<'de>,
339                {
340                    let mut m_userData: _serde::__private::Option<Ulong> = _serde::__private::None;
341                    let mut m_friction: _serde::__private::Option<u8> = _serde::__private::None;
342                    let mut m_restitution: _serde::__private::Option<u8> = _serde::__private::None;
343                    let mut m_maxImpulse: _serde::__private::Option<u8> = _serde::__private::None;
344                    let mut m_flags: _serde::__private::Option<u8> = _serde::__private::None;
345                    while let _serde::__private::Some(__key) = {
346                        __A::next_key::<__Field>(&mut __map)?
347                    } {
348                        match __key {
349                            __Field::m_userData => {
350                                #[cfg(
351                                    any(feature = "strict", feature = "ignore_duplicates")
352                                )]
353                                if _serde::__private::Option::is_some(&m_userData) {
354                                    #[cfg(feature = "ignore_duplicates")]
355                                    {
356                                        __A::skip_value(&mut __map)?;
357                                        continue;
358                                    }
359                                    #[cfg(feature = "strict")]
360                                    return _serde::__private::Err(
361                                        <__A::Error as _serde::de::Error>::duplicate_field(
362                                            "userData",
363                                        ),
364                                    );
365                                }
366                                m_userData = _serde::__private::Some(
367                                    match __A::next_value::<Ulong>(&mut __map) {
368                                        _serde::__private::Ok(__val) => __val,
369                                        _serde::__private::Err(__err) => {
370                                            return _serde::__private::Err(__err);
371                                        }
372                                    },
373                                );
374                            }
375                            __Field::m_friction => {
376                                #[cfg(
377                                    any(feature = "strict", feature = "ignore_duplicates")
378                                )]
379                                if _serde::__private::Option::is_some(&m_friction) {
380                                    #[cfg(feature = "ignore_duplicates")]
381                                    {
382                                        __A::skip_value(&mut __map)?;
383                                        continue;
384                                    }
385                                    #[cfg(feature = "strict")]
386                                    return _serde::__private::Err(
387                                        <__A::Error as _serde::de::Error>::duplicate_field(
388                                            "friction",
389                                        ),
390                                    );
391                                }
392                                m_friction = _serde::__private::Some(
393                                    match __A::next_value::<u8>(&mut __map) {
394                                        _serde::__private::Ok(__val) => __val,
395                                        _serde::__private::Err(__err) => {
396                                            return _serde::__private::Err(__err);
397                                        }
398                                    },
399                                );
400                            }
401                            __Field::m_restitution => {
402                                #[cfg(
403                                    any(feature = "strict", feature = "ignore_duplicates")
404                                )]
405                                if _serde::__private::Option::is_some(&m_restitution) {
406                                    #[cfg(feature = "ignore_duplicates")]
407                                    {
408                                        __A::skip_value(&mut __map)?;
409                                        continue;
410                                    }
411                                    #[cfg(feature = "strict")]
412                                    return _serde::__private::Err(
413                                        <__A::Error as _serde::de::Error>::duplicate_field(
414                                            "restitution",
415                                        ),
416                                    );
417                                }
418                                m_restitution = _serde::__private::Some(
419                                    match __A::next_value::<u8>(&mut __map) {
420                                        _serde::__private::Ok(__val) => __val,
421                                        _serde::__private::Err(__err) => {
422                                            return _serde::__private::Err(__err);
423                                        }
424                                    },
425                                );
426                            }
427                            __Field::m_maxImpulse => {
428                                #[cfg(
429                                    any(feature = "strict", feature = "ignore_duplicates")
430                                )]
431                                if _serde::__private::Option::is_some(&m_maxImpulse) {
432                                    #[cfg(feature = "ignore_duplicates")]
433                                    {
434                                        __A::skip_value(&mut __map)?;
435                                        continue;
436                                    }
437                                    #[cfg(feature = "strict")]
438                                    return _serde::__private::Err(
439                                        <__A::Error as _serde::de::Error>::duplicate_field(
440                                            "maxImpulse",
441                                        ),
442                                    );
443                                }
444                                m_maxImpulse = _serde::__private::Some(
445                                    match __A::next_value::<u8>(&mut __map) {
446                                        _serde::__private::Ok(__val) => __val,
447                                        _serde::__private::Err(__err) => {
448                                            return _serde::__private::Err(__err);
449                                        }
450                                    },
451                                );
452                            }
453                            __Field::m_flags => {
454                                #[cfg(
455                                    any(feature = "strict", feature = "ignore_duplicates")
456                                )]
457                                if _serde::__private::Option::is_some(&m_flags) {
458                                    #[cfg(feature = "ignore_duplicates")]
459                                    {
460                                        __A::skip_value(&mut __map)?;
461                                        continue;
462                                    }
463                                    #[cfg(feature = "strict")]
464                                    return _serde::__private::Err(
465                                        <__A::Error as _serde::de::Error>::duplicate_field("flags"),
466                                    );
467                                }
468                                m_flags = _serde::__private::Some(
469                                    match __A::next_value::<u8>(&mut __map) {
470                                        _serde::__private::Ok(__val) => __val,
471                                        _serde::__private::Err(__err) => {
472                                            return _serde::__private::Err(__err);
473                                        }
474                                    },
475                                );
476                            }
477                            _ => __A::skip_value(&mut __map)?,
478                        }
479                    }
480                    let m_userData = match m_userData {
481                        _serde::__private::Some(__field) => __field,
482                        _serde::__private::None => {
483                            #[cfg(feature = "strict")]
484                            return _serde::__private::Err(
485                                <__A::Error as _serde::de::Error>::missing_field("userData"),
486                            );
487                            #[cfg(not(feature = "strict"))] Default::default()
488                        }
489                    };
490                    let m_friction = match m_friction {
491                        _serde::__private::Some(__field) => __field,
492                        _serde::__private::None => {
493                            #[cfg(feature = "strict")]
494                            return _serde::__private::Err(
495                                <__A::Error as _serde::de::Error>::missing_field("friction"),
496                            );
497                            #[cfg(not(feature = "strict"))] Default::default()
498                        }
499                    };
500                    let m_restitution = match m_restitution {
501                        _serde::__private::Some(__field) => __field,
502                        _serde::__private::None => {
503                            #[cfg(feature = "strict")]
504                            return _serde::__private::Err(
505                                <__A::Error as _serde::de::Error>::missing_field(
506                                    "restitution",
507                                ),
508                            );
509                            #[cfg(not(feature = "strict"))] Default::default()
510                        }
511                    };
512                    let m_maxImpulse = match m_maxImpulse {
513                        _serde::__private::Some(__field) => __field,
514                        _serde::__private::None => {
515                            #[cfg(feature = "strict")]
516                            return _serde::__private::Err(
517                                <__A::Error as _serde::de::Error>::missing_field(
518                                    "maxImpulse",
519                                ),
520                            );
521                            #[cfg(not(feature = "strict"))] Default::default()
522                        }
523                    };
524                    let m_flags = match m_flags {
525                        _serde::__private::Some(__field) => __field,
526                        _serde::__private::None => {
527                            #[cfg(feature = "strict")]
528                            return _serde::__private::Err(
529                                <__A::Error as _serde::de::Error>::missing_field("flags"),
530                            );
531                            #[cfg(not(feature = "strict"))] Default::default()
532                        }
533                    };
534                    let __ptr = __A::class_ptr(&mut __map);
535                    _serde::__private::Ok(hkContactPointMaterial {
536                        __ptr,
537                        m_userData,
538                        m_friction,
539                        m_restitution,
540                        m_maxImpulse,
541                        m_flags,
542                    })
543                }
544            }
545            const FIELDS: &[&str] = &[
546                "userData",
547                "friction",
548                "restitution",
549                "maxImpulse",
550                "flags",
551            ];
552            _serde::Deserializer::deserialize_struct(
553                deserializer,
554                "hkContactPointMaterial",
555                FIELDS,
556                __hkContactPointMaterialVisitor {
557                    marker: _serde::__private::PhantomData::<hkContactPointMaterial>,
558                    lifetime: _serde::__private::PhantomData,
559                },
560            )
561        }
562    }
563};