havok_classes/generated/
hkpLinFrictionConstraintAtom_.rs

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