havok_classes/generated/
hkbExpressionCondition_.rs

1use super::class_requires::*;
2use super::*;
3/// # C++ Info
4/// - name: `hkbExpressionCondition`
5/// - version: `1`
6/// - signature: `0x1c3c1045`
7/// - size: ` 16`(x86)/` 32`(x86_64)
8/// -  vtable: `true`
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 hkbExpressionCondition<'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    /// Alternative to C++ class inheritance.
27    #[cfg_attr(feature = "json_schema", schemars(flatten))]
28    #[cfg_attr(feature = "serde", serde(flatten))]
29    pub parent: hkbCondition,
30    /// # C++ Info
31    /// - name: `expression`(ctype: `hkStringPtr`)
32    /// - offset: `  8`(x86)/` 16`(x86_64)
33    /// - type_size: `  4`(x86)/`  8`(x86_64)
34    #[cfg_attr(feature = "serde", serde(borrow))]
35    #[cfg_attr(feature = "json_schema", schemars(rename = "expression"))]
36    #[cfg_attr(feature = "serde", serde(rename = "expression"))]
37    pub m_expression: StringPtr<'a>,
38    /// # C++ Info
39    /// - name: `compiledExpressionSet`(ctype: `void*`)
40    /// - offset: ` 12`(x86)/` 24`(x86_64)
41    /// - type_size: `  4`(x86)/`  8`(x86_64)
42    /// - flags: `SERIALIZE_IGNORED`
43    #[cfg_attr(feature = "json_schema", schemars(rename = "compiledExpressionSet"))]
44    #[cfg_attr(feature = "serde", serde(rename = "compiledExpressionSet"))]
45    pub m_compiledExpressionSet: Pointer,
46}
47const _: () = {
48    use havok_serde as _serde;
49    impl<'a> _serde::HavokClass for hkbExpressionCondition<'a> {
50        #[inline]
51        fn name(&self) -> &'static str {
52            "hkbExpressionCondition"
53        }
54        #[inline]
55        fn signature(&self) -> _serde::__private::Signature {
56            _serde::__private::Signature::new(0x1c3c1045)
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_compiledExpressionSet.get());
62            v
63        }
64    }
65    impl<'a> _serde::Serialize for hkbExpressionCondition<'a> {
66        fn serialize<S>(&self, __serializer: S) -> Result<S::Ok, S::Error>
67        where
68            S: _serde::ser::Serializer,
69        {
70            let class_meta = self
71                .__ptr
72                .map(|name| (name, _serde::__private::Signature::new(0x1c3c1045)));
73            let mut serializer = __serializer
74                .serialize_struct("hkbExpressionCondition", class_meta, (16u64, 32u64))?;
75            serializer.pad_field([0u8; 4usize].as_slice(), [0u8; 8usize].as_slice())?;
76            serializer
77                .skip_field("memSizeAndFlags", &self.parent.parent.m_memSizeAndFlags)?;
78            serializer
79                .skip_field("referenceCount", &self.parent.parent.m_referenceCount)?;
80            serializer.pad_field([0u8; 0usize].as_slice(), [0u8; 4usize].as_slice())?;
81            serializer.serialize_field("expression", &self.m_expression)?;
82            serializer
83                .skip_field("compiledExpressionSet", &self.m_compiledExpressionSet)?;
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 hkbExpressionCondition<'de> {
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_expression,
101                __ignore,
102            }
103            struct __FieldVisitor;
104            impl<'de> _serde::de::Visitor<'de> for __FieldVisitor {
105                type Value = __Field;
106                fn expecting(
107                    &self,
108                    __formatter: &mut core::fmt::Formatter,
109                ) -> core::fmt::Result {
110                    core::fmt::Formatter::write_str(__formatter, "field identifier")
111                }
112                /// Intended for use in XML.
113                #[allow(clippy::match_single_binding)]
114                #[allow(clippy::reversed_empty_ranges)]
115                #[allow(clippy::single_match)]
116                fn visit_key<__E>(
117                    self,
118                    __value: &str,
119                ) -> core::result::Result<Self::Value, __E>
120                where
121                    __E: _serde::de::Error,
122                {
123                    match __value {
124                        "expression" => Ok(__Field::m_expression),
125                        _ => Ok(__Field::__ignore),
126                    }
127                }
128            }
129            impl<'de> _serde::Deserialize<'de> for __Field {
130                #[inline]
131                fn deserialize<__D>(
132                    __deserializer: __D,
133                ) -> core::result::Result<Self, __D::Error>
134                where
135                    __D: _serde::Deserializer<'de>,
136                {
137                    _serde::Deserializer::deserialize_key(__deserializer, __FieldVisitor)
138                }
139            }
140            struct __hkbExpressionConditionVisitor<'de> {
141                marker: _serde::__private::PhantomData<hkbExpressionCondition<'de>>,
142                lifetime: _serde::__private::PhantomData<&'de ()>,
143            }
144            #[allow(clippy::match_single_binding)]
145            #[allow(clippy::reversed_empty_ranges)]
146            #[allow(clippy::single_match)]
147            impl<'de> _serde::de::Visitor<'de> for __hkbExpressionConditionVisitor<'de> {
148                type Value = hkbExpressionCondition<'de>;
149                fn expecting(
150                    &self,
151                    __formatter: &mut core::fmt::Formatter,
152                ) -> core::fmt::Result {
153                    core::fmt::Formatter::write_str(
154                        __formatter,
155                        "struct hkbExpressionCondition",
156                    )
157                }
158                fn visit_struct_for_bytes<__A>(
159                    self,
160                    mut __map: __A,
161                ) -> _serde::__private::Result<Self::Value, __A::Error>
162                where
163                    __A: _serde::de::MapAccess<'de>,
164                {
165                    let __ptr = __A::class_ptr(&mut __map);
166                    let parent = __A::parent_value(&mut __map)?;
167                    let mut m_expression: _serde::__private::Option<StringPtr<'de>> = _serde::__private::None;
168                    let mut m_compiledExpressionSet: _serde::__private::Option<
169                        Pointer,
170                    > = _serde::__private::None;
171                    for i in 0..2usize {
172                        match i {
173                            0usize => {
174                                if _serde::__private::Option::is_some(&m_expression) {
175                                    return _serde::__private::Err(
176                                        <__A::Error as _serde::de::Error>::duplicate_field(
177                                            "expression",
178                                        ),
179                                    );
180                                }
181                                m_expression = _serde::__private::Some(
182                                    match __A::next_value::<StringPtr<'de>>(&mut __map) {
183                                        _serde::__private::Ok(__val) => __val,
184                                        _serde::__private::Err(__err) => {
185                                            return _serde::__private::Err(__err);
186                                        }
187                                    },
188                                );
189                            }
190                            1usize => {
191                                if _serde::__private::Option::is_some(
192                                    &m_compiledExpressionSet,
193                                ) {
194                                    return _serde::__private::Err(
195                                        <__A::Error as _serde::de::Error>::duplicate_field(
196                                            "compiledExpressionSet",
197                                        ),
198                                    );
199                                }
200                                m_compiledExpressionSet = _serde::__private::Some(
201                                    match __A::next_value::<Pointer>(&mut __map) {
202                                        _serde::__private::Ok(__val) => __val,
203                                        _serde::__private::Err(__err) => {
204                                            return _serde::__private::Err(__err);
205                                        }
206                                    },
207                                );
208                            }
209                            _ => {}
210                        }
211                    }
212                    let m_expression = match m_expression {
213                        _serde::__private::Some(__field) => __field,
214                        _serde::__private::None => {
215                            return _serde::__private::Err(
216                                <__A::Error as _serde::de::Error>::missing_field(
217                                    "expression",
218                                ),
219                            );
220                        }
221                    };
222                    let m_compiledExpressionSet = match m_compiledExpressionSet {
223                        _serde::__private::Some(__field) => __field,
224                        _serde::__private::None => {
225                            return _serde::__private::Err(
226                                <__A::Error as _serde::de::Error>::missing_field(
227                                    "compiledExpressionSet",
228                                ),
229                            );
230                        }
231                    };
232                    _serde::__private::Ok(hkbExpressionCondition {
233                        __ptr,
234                        parent,
235                        m_expression,
236                        m_compiledExpressionSet,
237                    })
238                }
239                #[allow(clippy::manual_unwrap_or_default)]
240                fn visit_struct<__A>(
241                    self,
242                    mut __map: __A,
243                ) -> _serde::__private::Result<Self::Value, __A::Error>
244                where
245                    __A: _serde::de::MapAccess<'de>,
246                {
247                    let mut m_expression: _serde::__private::Option<StringPtr<'de>> = _serde::__private::None;
248                    while let _serde::__private::Some(__key) = {
249                        __A::next_key::<__Field>(&mut __map)?
250                    } {
251                        match __key {
252                            __Field::m_expression => {
253                                #[cfg(
254                                    any(feature = "strict", feature = "ignore_duplicates")
255                                )]
256                                if _serde::__private::Option::is_some(&m_expression) {
257                                    #[cfg(feature = "ignore_duplicates")]
258                                    {
259                                        __A::skip_value(&mut __map)?;
260                                        continue;
261                                    }
262                                    #[cfg(feature = "strict")]
263                                    return _serde::__private::Err(
264                                        <__A::Error as _serde::de::Error>::duplicate_field(
265                                            "expression",
266                                        ),
267                                    );
268                                }
269                                m_expression = _serde::__private::Some(
270                                    match __A::next_value::<StringPtr<'de>>(&mut __map) {
271                                        _serde::__private::Ok(__val) => __val,
272                                        _serde::__private::Err(__err) => {
273                                            return _serde::__private::Err(__err);
274                                        }
275                                    },
276                                );
277                            }
278                            _ => __A::skip_value(&mut __map)?,
279                        }
280                    }
281                    let m_expression = match m_expression {
282                        _serde::__private::Some(__field) => __field,
283                        _serde::__private::None => {
284                            #[cfg(feature = "strict")]
285                            return _serde::__private::Err(
286                                <__A::Error as _serde::de::Error>::missing_field(
287                                    "expression",
288                                ),
289                            );
290                            #[cfg(not(feature = "strict"))] Default::default()
291                        }
292                    };
293                    let __ptr = None;
294                    let parent = hkBaseObject { __ptr };
295                    let parent = hkReferencedObject {
296                        __ptr,
297                        parent,
298                        ..Default::default()
299                    };
300                    let parent = hkbCondition { __ptr, parent };
301                    let __ptr = __A::class_ptr(&mut __map);
302                    _serde::__private::Ok(hkbExpressionCondition {
303                        __ptr,
304                        parent,
305                        m_expression,
306                        ..Default::default()
307                    })
308                }
309            }
310            const FIELDS: &[&str] = &["expression", "compiledExpressionSet"];
311            _serde::Deserializer::deserialize_struct(
312                deserializer,
313                "hkbExpressionCondition",
314                FIELDS,
315                __hkbExpressionConditionVisitor {
316                    marker: _serde::__private::PhantomData::<hkbExpressionCondition>,
317                    lifetime: _serde::__private::PhantomData,
318                },
319            )
320        }
321    }
322};