havok_classes/generated/
hkp2dAngConstraintAtom_.rs

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