havok_classes/generated/
hkpBridgeConstraintAtom_.rs

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