havok_classes/generated/
hkpPulleyConstraintDataAtoms_.rs

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