havok_classes/generated/
hkpSetLocalRotationsConstraintAtom_.rs

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