havok_classes/generated/
hkpStiffSpringConstraintAtom_.rs

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