havok_classes/generated/
hkxNodeAnnotationData_.rs

1use super::class_requires::*;
2use super::*;
3/// # C++ Info
4/// - name: `hkxNodeAnnotationData`
5/// - version: `0`
6/// - signature: `0x433dee92`
7/// - size: `  8`(x86)/` 16`(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 hkxNodeAnnotationData<'a> {
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    /// # C++ Info
27    /// - name: `time`(ctype: `hkReal`)
28    /// - offset: `  0`(x86)/`  0`(x86_64)
29    /// - type_size: `  4`(x86)/`  4`(x86_64)
30    #[cfg_attr(feature = "json_schema", schemars(rename = "time"))]
31    #[cfg_attr(feature = "serde", serde(rename = "time"))]
32    pub m_time: f32,
33    /// # C++ Info
34    /// - name: `description`(ctype: `hkStringPtr`)
35    /// - offset: `  4`(x86)/`  8`(x86_64)
36    /// - type_size: `  4`(x86)/`  8`(x86_64)
37    #[cfg_attr(feature = "serde", serde(borrow))]
38    #[cfg_attr(feature = "json_schema", schemars(rename = "description"))]
39    #[cfg_attr(feature = "serde", serde(rename = "description"))]
40    pub m_description: StringPtr<'a>,
41}
42const _: () = {
43    use havok_serde as _serde;
44    impl<'a> _serde::HavokClass for hkxNodeAnnotationData<'a> {
45        #[inline]
46        fn name(&self) -> &'static str {
47            "hkxNodeAnnotationData"
48        }
49        #[inline]
50        fn signature(&self) -> _serde::__private::Signature {
51            _serde::__private::Signature::new(0x433dee92)
52        }
53        #[allow(clippy::let_and_return, clippy::vec_init_then_push)]
54        fn deps_indexes(&self) -> Vec<usize> {
55            let mut v = Vec::new();
56            v
57        }
58    }
59    impl<'a> _serde::Serialize for hkxNodeAnnotationData<'a> {
60        fn serialize<S>(&self, __serializer: S) -> Result<S::Ok, S::Error>
61        where
62            S: _serde::ser::Serializer,
63        {
64            let class_meta = self
65                .__ptr
66                .map(|name| (name, _serde::__private::Signature::new(0x433dee92)));
67            let mut serializer = __serializer
68                .serialize_struct("hkxNodeAnnotationData", class_meta, (8u64, 16u64))?;
69            serializer.serialize_field("time", &self.m_time)?;
70            serializer.pad_field([0u8; 0usize].as_slice(), [0u8; 4usize].as_slice())?;
71            serializer.serialize_field("description", &self.m_description)?;
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 hkxNodeAnnotationData<'de> {
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_time,
89                m_description,
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                        "time" => Ok(__Field::m_time),
114                        "description" => Ok(__Field::m_description),
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 __hkxNodeAnnotationDataVisitor<'de> {
131                marker: _serde::__private::PhantomData<hkxNodeAnnotationData<'de>>,
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> for __hkxNodeAnnotationDataVisitor<'de> {
138                type Value = hkxNodeAnnotationData<'de>;
139                fn expecting(
140                    &self,
141                    __formatter: &mut core::fmt::Formatter,
142                ) -> core::fmt::Result {
143                    core::fmt::Formatter::write_str(
144                        __formatter,
145                        "struct hkxNodeAnnotationData",
146                    )
147                }
148                fn visit_struct_for_bytes<__A>(
149                    self,
150                    mut __map: __A,
151                ) -> _serde::__private::Result<Self::Value, __A::Error>
152                where
153                    __A: _serde::de::MapAccess<'de>,
154                {
155                    let __ptr = __A::class_ptr(&mut __map);
156                    let mut m_time: _serde::__private::Option<f32> = _serde::__private::None;
157                    let mut m_description: _serde::__private::Option<StringPtr<'de>> = _serde::__private::None;
158                    for i in 0..2usize {
159                        match i {
160                            0usize => {
161                                if _serde::__private::Option::is_some(&m_time) {
162                                    return _serde::__private::Err(
163                                        <__A::Error as _serde::de::Error>::duplicate_field("time"),
164                                    );
165                                }
166                                m_time = _serde::__private::Some(
167                                    match __A::next_value::<f32>(&mut __map) {
168                                        _serde::__private::Ok(__val) => __val,
169                                        _serde::__private::Err(__err) => {
170                                            return _serde::__private::Err(__err);
171                                        }
172                                    },
173                                );
174                            }
175                            1usize => {
176                                if _serde::__private::Option::is_some(&m_description) {
177                                    return _serde::__private::Err(
178                                        <__A::Error as _serde::de::Error>::duplicate_field(
179                                            "description",
180                                        ),
181                                    );
182                                }
183                                __A::pad(&mut __map, 0usize, 4usize)?;
184                                m_description = _serde::__private::Some(
185                                    match __A::next_value::<StringPtr<'de>>(&mut __map) {
186                                        _serde::__private::Ok(__val) => __val,
187                                        _serde::__private::Err(__err) => {
188                                            return _serde::__private::Err(__err);
189                                        }
190                                    },
191                                );
192                            }
193                            _ => {}
194                        }
195                    }
196                    let m_time = match m_time {
197                        _serde::__private::Some(__field) => __field,
198                        _serde::__private::None => {
199                            return _serde::__private::Err(
200                                <__A::Error as _serde::de::Error>::missing_field("time"),
201                            );
202                        }
203                    };
204                    let m_description = match m_description {
205                        _serde::__private::Some(__field) => __field,
206                        _serde::__private::None => {
207                            return _serde::__private::Err(
208                                <__A::Error as _serde::de::Error>::missing_field(
209                                    "description",
210                                ),
211                            );
212                        }
213                    };
214                    _serde::__private::Ok(hkxNodeAnnotationData {
215                        __ptr,
216                        m_time,
217                        m_description,
218                    })
219                }
220                #[allow(clippy::manual_unwrap_or_default)]
221                fn visit_struct<__A>(
222                    self,
223                    mut __map: __A,
224                ) -> _serde::__private::Result<Self::Value, __A::Error>
225                where
226                    __A: _serde::de::MapAccess<'de>,
227                {
228                    let mut m_time: _serde::__private::Option<f32> = _serde::__private::None;
229                    let mut m_description: _serde::__private::Option<StringPtr<'de>> = _serde::__private::None;
230                    while let _serde::__private::Some(__key) = {
231                        __A::next_key::<__Field>(&mut __map)?
232                    } {
233                        match __key {
234                            __Field::m_time => {
235                                #[cfg(
236                                    any(feature = "strict", feature = "ignore_duplicates")
237                                )]
238                                if _serde::__private::Option::is_some(&m_time) {
239                                    #[cfg(feature = "ignore_duplicates")]
240                                    {
241                                        __A::skip_value(&mut __map)?;
242                                        continue;
243                                    }
244                                    #[cfg(feature = "strict")]
245                                    return _serde::__private::Err(
246                                        <__A::Error as _serde::de::Error>::duplicate_field("time"),
247                                    );
248                                }
249                                m_time = _serde::__private::Some(
250                                    match __A::next_value::<f32>(&mut __map) {
251                                        _serde::__private::Ok(__val) => __val,
252                                        _serde::__private::Err(__err) => {
253                                            return _serde::__private::Err(__err);
254                                        }
255                                    },
256                                );
257                            }
258                            __Field::m_description => {
259                                #[cfg(
260                                    any(feature = "strict", feature = "ignore_duplicates")
261                                )]
262                                if _serde::__private::Option::is_some(&m_description) {
263                                    #[cfg(feature = "ignore_duplicates")]
264                                    {
265                                        __A::skip_value(&mut __map)?;
266                                        continue;
267                                    }
268                                    #[cfg(feature = "strict")]
269                                    return _serde::__private::Err(
270                                        <__A::Error as _serde::de::Error>::duplicate_field(
271                                            "description",
272                                        ),
273                                    );
274                                }
275                                m_description = _serde::__private::Some(
276                                    match __A::next_value::<StringPtr<'de>>(&mut __map) {
277                                        _serde::__private::Ok(__val) => __val,
278                                        _serde::__private::Err(__err) => {
279                                            return _serde::__private::Err(__err);
280                                        }
281                                    },
282                                );
283                            }
284                            _ => __A::skip_value(&mut __map)?,
285                        }
286                    }
287                    let m_time = match m_time {
288                        _serde::__private::Some(__field) => __field,
289                        _serde::__private::None => {
290                            #[cfg(feature = "strict")]
291                            return _serde::__private::Err(
292                                <__A::Error as _serde::de::Error>::missing_field("time"),
293                            );
294                            #[cfg(not(feature = "strict"))] Default::default()
295                        }
296                    };
297                    let m_description = match m_description {
298                        _serde::__private::Some(__field) => __field,
299                        _serde::__private::None => {
300                            #[cfg(feature = "strict")]
301                            return _serde::__private::Err(
302                                <__A::Error as _serde::de::Error>::missing_field(
303                                    "description",
304                                ),
305                            );
306                            #[cfg(not(feature = "strict"))] Default::default()
307                        }
308                    };
309                    let __ptr = __A::class_ptr(&mut __map);
310                    _serde::__private::Ok(hkxNodeAnnotationData {
311                        __ptr,
312                        m_time,
313                        m_description,
314                    })
315                }
316            }
317            const FIELDS: &[&str] = &["time", "description"];
318            _serde::Deserializer::deserialize_struct(
319                deserializer,
320                "hkxNodeAnnotationData",
321                FIELDS,
322                __hkxNodeAnnotationDataVisitor {
323                    marker: _serde::__private::PhantomData::<hkxNodeAnnotationData>,
324                    lifetime: _serde::__private::PhantomData,
325                },
326            )
327        }
328    }
329};