havok_classes/generated/
hkpOverwritePivotConstraintAtom_.rs

1use super::class_requires::*;
2use super::*;
3/// # C++ Info
4/// - name: `hkpOverwritePivotConstraintAtom`
5/// - version: `0`
6/// - signature: `0x1f11b467`
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 hkpOverwritePivotConstraintAtom {
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: `copyToPivotBFromPivotA`(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 = "copyToPivotBFromPivotA"))]
35    #[cfg_attr(feature = "serde", serde(rename = "copyToPivotBFromPivotA"))]
36    pub m_copyToPivotBFromPivotA: u8,
37}
38const _: () = {
39    use havok_serde as _serde;
40    impl _serde::HavokClass for hkpOverwritePivotConstraintAtom {
41        #[inline]
42        fn name(&self) -> &'static str {
43            "hkpOverwritePivotConstraintAtom"
44        }
45        #[inline]
46        fn signature(&self) -> _serde::__private::Signature {
47            _serde::__private::Signature::new(0x1f11b467)
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 hkpOverwritePivotConstraintAtom {
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(0x1f11b467)));
63            let mut serializer = __serializer
64                .serialize_struct(
65                    "hkpOverwritePivotConstraintAtom",
66                    class_meta,
67                    (4u64, 4u64),
68                )?;
69            serializer.serialize_field("type", &self.parent.m_type)?;
70            serializer
71                .serialize_field(
72                    "copyToPivotBFromPivotA",
73                    &self.m_copyToPivotBFromPivotA,
74                )?;
75            serializer.pad_field([0u8; 1usize].as_slice(), [0u8; 1usize].as_slice())?;
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 hkpOverwritePivotConstraintAtom {
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_type,
93                m_copyToPivotBFromPivotA,
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                        "type" => Ok(__Field::m_type),
118                        "copyToPivotBFromPivotA" => Ok(__Field::m_copyToPivotBFromPivotA),
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 __hkpOverwritePivotConstraintAtomVisitor<'de> {
135                marker: _serde::__private::PhantomData<hkpOverwritePivotConstraintAtom>,
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 __hkpOverwritePivotConstraintAtomVisitor<'de> {
143                type Value = hkpOverwritePivotConstraintAtom;
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 hkpOverwritePivotConstraintAtom",
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 parent = __A::parent_value(&mut __map)?;
162                    let mut m_copyToPivotBFromPivotA: _serde::__private::Option<u8> = _serde::__private::None;
163                    for i in 0..1usize {
164                        match i {
165                            0usize => {
166                                if _serde::__private::Option::is_some(
167                                    &m_copyToPivotBFromPivotA,
168                                ) {
169                                    return _serde::__private::Err(
170                                        <__A::Error as _serde::de::Error>::duplicate_field(
171                                            "copyToPivotBFromPivotA",
172                                        ),
173                                    );
174                                }
175                                m_copyToPivotBFromPivotA = _serde::__private::Some(
176                                    match __A::next_value::<u8>(&mut __map) {
177                                        _serde::__private::Ok(__val) => __val,
178                                        _serde::__private::Err(__err) => {
179                                            return _serde::__private::Err(__err);
180                                        }
181                                    },
182                                );
183                            }
184                            _ => {}
185                        }
186                    }
187                    __A::pad(&mut __map, 1usize, 1usize)?;
188                    let m_copyToPivotBFromPivotA = match m_copyToPivotBFromPivotA {
189                        _serde::__private::Some(__field) => __field,
190                        _serde::__private::None => {
191                            return _serde::__private::Err(
192                                <__A::Error as _serde::de::Error>::missing_field(
193                                    "copyToPivotBFromPivotA",
194                                ),
195                            );
196                        }
197                    };
198                    _serde::__private::Ok(hkpOverwritePivotConstraintAtom {
199                        __ptr,
200                        parent,
201                        m_copyToPivotBFromPivotA,
202                    })
203                }
204                #[allow(clippy::manual_unwrap_or_default)]
205                fn visit_struct<__A>(
206                    self,
207                    mut __map: __A,
208                ) -> _serde::__private::Result<Self::Value, __A::Error>
209                where
210                    __A: _serde::de::MapAccess<'de>,
211                {
212                    let mut m_type: _serde::__private::Option<AtomType> = _serde::__private::None;
213                    let mut m_copyToPivotBFromPivotA: _serde::__private::Option<u8> = _serde::__private::None;
214                    while let _serde::__private::Some(__key) = {
215                        __A::next_key::<__Field>(&mut __map)?
216                    } {
217                        match __key {
218                            __Field::m_type => {
219                                #[cfg(
220                                    any(feature = "strict", feature = "ignore_duplicates")
221                                )]
222                                if _serde::__private::Option::is_some(&m_type) {
223                                    #[cfg(feature = "ignore_duplicates")]
224                                    {
225                                        __A::skip_value(&mut __map)?;
226                                        continue;
227                                    }
228                                    #[cfg(feature = "strict")]
229                                    return _serde::__private::Err(
230                                        <__A::Error as _serde::de::Error>::duplicate_field("type"),
231                                    );
232                                }
233                                m_type = _serde::__private::Some(
234                                    match __A::next_value::<AtomType>(&mut __map) {
235                                        _serde::__private::Ok(__val) => __val,
236                                        _serde::__private::Err(__err) => {
237                                            return _serde::__private::Err(__err);
238                                        }
239                                    },
240                                );
241                            }
242                            __Field::m_copyToPivotBFromPivotA => {
243                                #[cfg(
244                                    any(feature = "strict", feature = "ignore_duplicates")
245                                )]
246                                if _serde::__private::Option::is_some(
247                                    &m_copyToPivotBFromPivotA,
248                                ) {
249                                    #[cfg(feature = "ignore_duplicates")]
250                                    {
251                                        __A::skip_value(&mut __map)?;
252                                        continue;
253                                    }
254                                    #[cfg(feature = "strict")]
255                                    return _serde::__private::Err(
256                                        <__A::Error as _serde::de::Error>::duplicate_field(
257                                            "copyToPivotBFromPivotA",
258                                        ),
259                                    );
260                                }
261                                m_copyToPivotBFromPivotA = _serde::__private::Some(
262                                    match __A::next_value::<u8>(&mut __map) {
263                                        _serde::__private::Ok(__val) => __val,
264                                        _serde::__private::Err(__err) => {
265                                            return _serde::__private::Err(__err);
266                                        }
267                                    },
268                                );
269                            }
270                            _ => __A::skip_value(&mut __map)?,
271                        }
272                    }
273                    let m_type = match m_type {
274                        _serde::__private::Some(__field) => __field,
275                        _serde::__private::None => {
276                            #[cfg(feature = "strict")]
277                            return _serde::__private::Err(
278                                <__A::Error as _serde::de::Error>::missing_field("type"),
279                            );
280                            #[cfg(not(feature = "strict"))] Default::default()
281                        }
282                    };
283                    let m_copyToPivotBFromPivotA = match m_copyToPivotBFromPivotA {
284                        _serde::__private::Some(__field) => __field,
285                        _serde::__private::None => {
286                            #[cfg(feature = "strict")]
287                            return _serde::__private::Err(
288                                <__A::Error as _serde::de::Error>::missing_field(
289                                    "copyToPivotBFromPivotA",
290                                ),
291                            );
292                            #[cfg(not(feature = "strict"))] Default::default()
293                        }
294                    };
295                    let __ptr = None;
296                    let parent = hkpConstraintAtom { __ptr, m_type };
297                    let __ptr = __A::class_ptr(&mut __map);
298                    _serde::__private::Ok(hkpOverwritePivotConstraintAtom {
299                        __ptr,
300                        parent,
301                        m_copyToPivotBFromPivotA,
302                    })
303                }
304            }
305            const FIELDS: &[&str] = &["copyToPivotBFromPivotA"];
306            _serde::Deserializer::deserialize_struct(
307                deserializer,
308                "hkpOverwritePivotConstraintAtom",
309                FIELDS,
310                __hkpOverwritePivotConstraintAtomVisitor {
311                    marker: _serde::__private::PhantomData::<
312                        hkpOverwritePivotConstraintAtom,
313                    >,
314                    lifetime: _serde::__private::PhantomData,
315                },
316            )
317        }
318    }
319};