havok_classes/generated/
hkbStringCondition_.rs

1use super::class_requires::*;
2use super::*;
3/// # C++ Info
4/// - name: `hkbStringCondition`
5/// - version: `0`
6/// - signature: `0x5ab50487`
7/// - size: ` 12`(x86)/` 24`(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 hkbStringCondition<'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: `conditionString`(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 = "conditionString"))]
36    #[cfg_attr(feature = "serde", serde(rename = "conditionString"))]
37    pub m_conditionString: StringPtr<'a>,
38}
39const _: () = {
40    use havok_serde as _serde;
41    impl<'a> _serde::HavokClass for hkbStringCondition<'a> {
42        #[inline]
43        fn name(&self) -> &'static str {
44            "hkbStringCondition"
45        }
46        #[inline]
47        fn signature(&self) -> _serde::__private::Signature {
48            _serde::__private::Signature::new(0x5ab50487)
49        }
50        #[allow(clippy::let_and_return, clippy::vec_init_then_push)]
51        fn deps_indexes(&self) -> Vec<usize> {
52            let mut v = Vec::new();
53            v
54        }
55    }
56    impl<'a> _serde::Serialize for hkbStringCondition<'a> {
57        fn serialize<S>(&self, __serializer: S) -> Result<S::Ok, S::Error>
58        where
59            S: _serde::ser::Serializer,
60        {
61            let class_meta = self
62                .__ptr
63                .map(|name| (name, _serde::__private::Signature::new(0x5ab50487)));
64            let mut serializer = __serializer
65                .serialize_struct("hkbStringCondition", class_meta, (12u64, 24u64))?;
66            serializer.pad_field([0u8; 4usize].as_slice(), [0u8; 8usize].as_slice())?;
67            serializer
68                .skip_field("memSizeAndFlags", &self.parent.parent.m_memSizeAndFlags)?;
69            serializer
70                .skip_field("referenceCount", &self.parent.parent.m_referenceCount)?;
71            serializer.pad_field([0u8; 0usize].as_slice(), [0u8; 4usize].as_slice())?;
72            serializer.serialize_field("conditionString", &self.m_conditionString)?;
73            serializer.end()
74        }
75    }
76};
77#[doc(hidden)]
78#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
79const _: () = {
80    use havok_serde as _serde;
81    #[automatically_derived]
82    impl<'de> _serde::Deserialize<'de> for hkbStringCondition<'de> {
83        fn deserialize<__D>(deserializer: __D) -> core::result::Result<Self, __D::Error>
84        where
85            __D: _serde::Deserializer<'de>,
86        {
87            #[allow(non_camel_case_types)]
88            enum __Field {
89                m_conditionString,
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                        "conditionString" => Ok(__Field::m_conditionString),
114                        _ => Ok(__Field::__ignore),
115                    }
116                }
117            }
118            impl<'de> _serde::Deserialize<'de> for __Field {
119                #[inline]
120                fn deserialize<__D>(
121                    __deserializer: __D,
122                ) -> core::result::Result<Self, __D::Error>
123                where
124                    __D: _serde::Deserializer<'de>,
125                {
126                    _serde::Deserializer::deserialize_key(__deserializer, __FieldVisitor)
127                }
128            }
129            struct __hkbStringConditionVisitor<'de> {
130                marker: _serde::__private::PhantomData<hkbStringCondition<'de>>,
131                lifetime: _serde::__private::PhantomData<&'de ()>,
132            }
133            #[allow(clippy::match_single_binding)]
134            #[allow(clippy::reversed_empty_ranges)]
135            #[allow(clippy::single_match)]
136            impl<'de> _serde::de::Visitor<'de> for __hkbStringConditionVisitor<'de> {
137                type Value = hkbStringCondition<'de>;
138                fn expecting(
139                    &self,
140                    __formatter: &mut core::fmt::Formatter,
141                ) -> core::fmt::Result {
142                    core::fmt::Formatter::write_str(
143                        __formatter,
144                        "struct hkbStringCondition",
145                    )
146                }
147                fn visit_struct_for_bytes<__A>(
148                    self,
149                    mut __map: __A,
150                ) -> _serde::__private::Result<Self::Value, __A::Error>
151                where
152                    __A: _serde::de::MapAccess<'de>,
153                {
154                    let __ptr = __A::class_ptr(&mut __map);
155                    let parent = __A::parent_value(&mut __map)?;
156                    let mut m_conditionString: _serde::__private::Option<
157                        StringPtr<'de>,
158                    > = _serde::__private::None;
159                    for i in 0..1usize {
160                        match i {
161                            0usize => {
162                                if _serde::__private::Option::is_some(&m_conditionString) {
163                                    return _serde::__private::Err(
164                                        <__A::Error as _serde::de::Error>::duplicate_field(
165                                            "conditionString",
166                                        ),
167                                    );
168                                }
169                                m_conditionString = _serde::__private::Some(
170                                    match __A::next_value::<StringPtr<'de>>(&mut __map) {
171                                        _serde::__private::Ok(__val) => __val,
172                                        _serde::__private::Err(__err) => {
173                                            return _serde::__private::Err(__err);
174                                        }
175                                    },
176                                );
177                            }
178                            _ => {}
179                        }
180                    }
181                    let m_conditionString = match m_conditionString {
182                        _serde::__private::Some(__field) => __field,
183                        _serde::__private::None => {
184                            return _serde::__private::Err(
185                                <__A::Error as _serde::de::Error>::missing_field(
186                                    "conditionString",
187                                ),
188                            );
189                        }
190                    };
191                    _serde::__private::Ok(hkbStringCondition {
192                        __ptr,
193                        parent,
194                        m_conditionString,
195                    })
196                }
197                #[allow(clippy::manual_unwrap_or_default)]
198                fn visit_struct<__A>(
199                    self,
200                    mut __map: __A,
201                ) -> _serde::__private::Result<Self::Value, __A::Error>
202                where
203                    __A: _serde::de::MapAccess<'de>,
204                {
205                    let mut m_conditionString: _serde::__private::Option<
206                        StringPtr<'de>,
207                    > = _serde::__private::None;
208                    while let _serde::__private::Some(__key) = {
209                        __A::next_key::<__Field>(&mut __map)?
210                    } {
211                        match __key {
212                            __Field::m_conditionString => {
213                                #[cfg(
214                                    any(feature = "strict", feature = "ignore_duplicates")
215                                )]
216                                if _serde::__private::Option::is_some(&m_conditionString) {
217                                    #[cfg(feature = "ignore_duplicates")]
218                                    {
219                                        __A::skip_value(&mut __map)?;
220                                        continue;
221                                    }
222                                    #[cfg(feature = "strict")]
223                                    return _serde::__private::Err(
224                                        <__A::Error as _serde::de::Error>::duplicate_field(
225                                            "conditionString",
226                                        ),
227                                    );
228                                }
229                                m_conditionString = _serde::__private::Some(
230                                    match __A::next_value::<StringPtr<'de>>(&mut __map) {
231                                        _serde::__private::Ok(__val) => __val,
232                                        _serde::__private::Err(__err) => {
233                                            return _serde::__private::Err(__err);
234                                        }
235                                    },
236                                );
237                            }
238                            _ => __A::skip_value(&mut __map)?,
239                        }
240                    }
241                    let m_conditionString = match m_conditionString {
242                        _serde::__private::Some(__field) => __field,
243                        _serde::__private::None => {
244                            #[cfg(feature = "strict")]
245                            return _serde::__private::Err(
246                                <__A::Error as _serde::de::Error>::missing_field(
247                                    "conditionString",
248                                ),
249                            );
250                            #[cfg(not(feature = "strict"))] Default::default()
251                        }
252                    };
253                    let __ptr = None;
254                    let parent = hkBaseObject { __ptr };
255                    let parent = hkReferencedObject {
256                        __ptr,
257                        parent,
258                        ..Default::default()
259                    };
260                    let parent = hkbCondition { __ptr, parent };
261                    let __ptr = __A::class_ptr(&mut __map);
262                    _serde::__private::Ok(hkbStringCondition {
263                        __ptr,
264                        parent,
265                        m_conditionString,
266                    })
267                }
268            }
269            const FIELDS: &[&str] = &["conditionString"];
270            _serde::Deserializer::deserialize_struct(
271                deserializer,
272                "hkbStringCondition",
273                FIELDS,
274                __hkbStringConditionVisitor {
275                    marker: _serde::__private::PhantomData::<hkbStringCondition>,
276                    lifetime: _serde::__private::PhantomData,
277                },
278            )
279        }
280    }
281};