havok_classes/generated/
hkbIntVariableSequencedDataSample_.rs

1use super::class_requires::*;
2use super::*;
3/// # C++ Info
4/// - name: `hkbIntVariableSequencedDataSample`
5/// - version: `0`
6/// - signature: `0xbe7ac63c`
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 hkbIntVariableSequencedDataSample {
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: `value`(ctype: `hkInt32`)
35    /// - offset: `  4`(x86)/`  4`(x86_64)
36    /// - type_size: `  4`(x86)/`  4`(x86_64)
37    #[cfg_attr(feature = "json_schema", schemars(rename = "value"))]
38    #[cfg_attr(feature = "serde", serde(rename = "value"))]
39    pub m_value: i32,
40}
41const _: () = {
42    use havok_serde as _serde;
43    impl _serde::HavokClass for hkbIntVariableSequencedDataSample {
44        #[inline]
45        fn name(&self) -> &'static str {
46            "hkbIntVariableSequencedDataSample"
47        }
48        #[inline]
49        fn signature(&self) -> _serde::__private::Signature {
50            _serde::__private::Signature::new(0xbe7ac63c)
51        }
52        #[allow(clippy::let_and_return, clippy::vec_init_then_push)]
53        fn deps_indexes(&self) -> Vec<usize> {
54            let mut v = Vec::new();
55            v
56        }
57    }
58    impl _serde::Serialize for hkbIntVariableSequencedDataSample {
59        fn serialize<S>(&self, __serializer: S) -> Result<S::Ok, S::Error>
60        where
61            S: _serde::ser::Serializer,
62        {
63            let class_meta = self
64                .__ptr
65                .map(|name| (name, _serde::__private::Signature::new(0xbe7ac63c)));
66            let mut serializer = __serializer
67                .serialize_struct(
68                    "hkbIntVariableSequencedDataSample",
69                    class_meta,
70                    (8u64, 8u64),
71                )?;
72            serializer.serialize_field("time", &self.m_time)?;
73            serializer.serialize_field("value", &self.m_value)?;
74            serializer.end()
75        }
76    }
77};
78#[doc(hidden)]
79#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
80const _: () = {
81    use havok_serde as _serde;
82    #[automatically_derived]
83    impl<'de> _serde::Deserialize<'de> for hkbIntVariableSequencedDataSample {
84        fn deserialize<__D>(deserializer: __D) -> core::result::Result<Self, __D::Error>
85        where
86            __D: _serde::Deserializer<'de>,
87        {
88            #[allow(non_camel_case_types)]
89            enum __Field {
90                m_time,
91                m_value,
92                __ignore,
93            }
94            struct __FieldVisitor;
95            impl<'de> _serde::de::Visitor<'de> for __FieldVisitor {
96                type Value = __Field;
97                fn expecting(
98                    &self,
99                    __formatter: &mut core::fmt::Formatter,
100                ) -> core::fmt::Result {
101                    core::fmt::Formatter::write_str(__formatter, "field identifier")
102                }
103                /// Intended for use in XML.
104                #[allow(clippy::match_single_binding)]
105                #[allow(clippy::reversed_empty_ranges)]
106                #[allow(clippy::single_match)]
107                fn visit_key<__E>(
108                    self,
109                    __value: &str,
110                ) -> core::result::Result<Self::Value, __E>
111                where
112                    __E: _serde::de::Error,
113                {
114                    match __value {
115                        "time" => Ok(__Field::m_time),
116                        "value" => Ok(__Field::m_value),
117                        _ => Ok(__Field::__ignore),
118                    }
119                }
120            }
121            impl<'de> _serde::Deserialize<'de> for __Field {
122                #[inline]
123                fn deserialize<__D>(
124                    __deserializer: __D,
125                ) -> core::result::Result<Self, __D::Error>
126                where
127                    __D: _serde::Deserializer<'de>,
128                {
129                    _serde::Deserializer::deserialize_key(__deserializer, __FieldVisitor)
130                }
131            }
132            struct __hkbIntVariableSequencedDataSampleVisitor<'de> {
133                marker: _serde::__private::PhantomData<
134                    hkbIntVariableSequencedDataSample,
135                >,
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 __hkbIntVariableSequencedDataSampleVisitor<'de> {
143                type Value = hkbIntVariableSequencedDataSample;
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 hkbIntVariableSequencedDataSample",
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 mut m_time: _serde::__private::Option<f32> = _serde::__private::None;
162                    let mut m_value: _serde::__private::Option<i32> = _serde::__private::None;
163                    for i in 0..2usize {
164                        match i {
165                            0usize => {
166                                if _serde::__private::Option::is_some(&m_time) {
167                                    return _serde::__private::Err(
168                                        <__A::Error as _serde::de::Error>::duplicate_field("time"),
169                                    );
170                                }
171                                m_time = _serde::__private::Some(
172                                    match __A::next_value::<f32>(&mut __map) {
173                                        _serde::__private::Ok(__val) => __val,
174                                        _serde::__private::Err(__err) => {
175                                            return _serde::__private::Err(__err);
176                                        }
177                                    },
178                                );
179                            }
180                            1usize => {
181                                if _serde::__private::Option::is_some(&m_value) {
182                                    return _serde::__private::Err(
183                                        <__A::Error as _serde::de::Error>::duplicate_field("value"),
184                                    );
185                                }
186                                m_value = _serde::__private::Some(
187                                    match __A::next_value::<i32>(&mut __map) {
188                                        _serde::__private::Ok(__val) => __val,
189                                        _serde::__private::Err(__err) => {
190                                            return _serde::__private::Err(__err);
191                                        }
192                                    },
193                                );
194                            }
195                            _ => {}
196                        }
197                    }
198                    let m_time = match m_time {
199                        _serde::__private::Some(__field) => __field,
200                        _serde::__private::None => {
201                            return _serde::__private::Err(
202                                <__A::Error as _serde::de::Error>::missing_field("time"),
203                            );
204                        }
205                    };
206                    let m_value = match m_value {
207                        _serde::__private::Some(__field) => __field,
208                        _serde::__private::None => {
209                            return _serde::__private::Err(
210                                <__A::Error as _serde::de::Error>::missing_field("value"),
211                            );
212                        }
213                    };
214                    _serde::__private::Ok(hkbIntVariableSequencedDataSample {
215                        __ptr,
216                        m_time,
217                        m_value,
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_value: _serde::__private::Option<i32> = _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_value => {
259                                #[cfg(
260                                    any(feature = "strict", feature = "ignore_duplicates")
261                                )]
262                                if _serde::__private::Option::is_some(&m_value) {
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("value"),
271                                    );
272                                }
273                                m_value = _serde::__private::Some(
274                                    match __A::next_value::<i32>(&mut __map) {
275                                        _serde::__private::Ok(__val) => __val,
276                                        _serde::__private::Err(__err) => {
277                                            return _serde::__private::Err(__err);
278                                        }
279                                    },
280                                );
281                            }
282                            _ => __A::skip_value(&mut __map)?,
283                        }
284                    }
285                    let m_time = match m_time {
286                        _serde::__private::Some(__field) => __field,
287                        _serde::__private::None => {
288                            #[cfg(feature = "strict")]
289                            return _serde::__private::Err(
290                                <__A::Error as _serde::de::Error>::missing_field("time"),
291                            );
292                            #[cfg(not(feature = "strict"))] Default::default()
293                        }
294                    };
295                    let m_value = match m_value {
296                        _serde::__private::Some(__field) => __field,
297                        _serde::__private::None => {
298                            #[cfg(feature = "strict")]
299                            return _serde::__private::Err(
300                                <__A::Error as _serde::de::Error>::missing_field("value"),
301                            );
302                            #[cfg(not(feature = "strict"))] Default::default()
303                        }
304                    };
305                    let __ptr = __A::class_ptr(&mut __map);
306                    _serde::__private::Ok(hkbIntVariableSequencedDataSample {
307                        __ptr,
308                        m_time,
309                        m_value,
310                    })
311                }
312            }
313            const FIELDS: &[&str] = &["time", "value"];
314            _serde::Deserializer::deserialize_struct(
315                deserializer,
316                "hkbIntVariableSequencedDataSample",
317                FIELDS,
318                __hkbIntVariableSequencedDataSampleVisitor {
319                    marker: _serde::__private::PhantomData::<
320                        hkbIntVariableSequencedDataSample,
321                    >,
322                    lifetime: _serde::__private::PhantomData,
323                },
324            )
325        }
326    }
327};