havok_classes/generated/
hkDescriptionAttribute_.rs

1use super::class_requires::*;
2use super::*;
3/// # C++ Info
4/// - name: `hkDescriptionAttribute`
5/// - version: `0`
6/// - signature: `0xe9f9578a`
7/// - size: `  4`(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 hkDescriptionAttribute<'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: `string`(ctype: `char*`)
28    /// - offset: `  0`(x86)/`  0`(x86_64)
29    /// - type_size: `  4`(x86)/`  8`(x86_64)
30    #[cfg_attr(feature = "serde", serde(borrow))]
31    #[cfg_attr(feature = "json_schema", schemars(rename = "string"))]
32    #[cfg_attr(feature = "serde", serde(rename = "string"))]
33    pub m_string: CString<'a>,
34}
35const _: () = {
36    use havok_serde as _serde;
37    impl<'a> _serde::HavokClass for hkDescriptionAttribute<'a> {
38        #[inline]
39        fn name(&self) -> &'static str {
40            "hkDescriptionAttribute"
41        }
42        #[inline]
43        fn signature(&self) -> _serde::__private::Signature {
44            _serde::__private::Signature::new(0xe9f9578a)
45        }
46        #[allow(clippy::let_and_return, clippy::vec_init_then_push)]
47        fn deps_indexes(&self) -> Vec<usize> {
48            let mut v = Vec::new();
49            v
50        }
51    }
52    impl<'a> _serde::Serialize for hkDescriptionAttribute<'a> {
53        fn serialize<S>(&self, __serializer: S) -> Result<S::Ok, S::Error>
54        where
55            S: _serde::ser::Serializer,
56        {
57            let class_meta = self
58                .__ptr
59                .map(|name| (name, _serde::__private::Signature::new(0xe9f9578a)));
60            let mut serializer = __serializer
61                .serialize_struct("hkDescriptionAttribute", class_meta, (4u64, 8u64))?;
62            serializer.serialize_field("string", &self.m_string)?;
63            serializer.end()
64        }
65    }
66};
67#[doc(hidden)]
68#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
69const _: () = {
70    use havok_serde as _serde;
71    #[automatically_derived]
72    impl<'de> _serde::Deserialize<'de> for hkDescriptionAttribute<'de> {
73        fn deserialize<__D>(deserializer: __D) -> core::result::Result<Self, __D::Error>
74        where
75            __D: _serde::Deserializer<'de>,
76        {
77            #[allow(non_camel_case_types)]
78            enum __Field {
79                m_string,
80                __ignore,
81            }
82            struct __FieldVisitor;
83            impl<'de> _serde::de::Visitor<'de> for __FieldVisitor {
84                type Value = __Field;
85                fn expecting(
86                    &self,
87                    __formatter: &mut core::fmt::Formatter,
88                ) -> core::fmt::Result {
89                    core::fmt::Formatter::write_str(__formatter, "field identifier")
90                }
91                /// Intended for use in XML.
92                #[allow(clippy::match_single_binding)]
93                #[allow(clippy::reversed_empty_ranges)]
94                #[allow(clippy::single_match)]
95                fn visit_key<__E>(
96                    self,
97                    __value: &str,
98                ) -> core::result::Result<Self::Value, __E>
99                where
100                    __E: _serde::de::Error,
101                {
102                    match __value {
103                        "string" => Ok(__Field::m_string),
104                        _ => Ok(__Field::__ignore),
105                    }
106                }
107            }
108            impl<'de> _serde::Deserialize<'de> for __Field {
109                #[inline]
110                fn deserialize<__D>(
111                    __deserializer: __D,
112                ) -> core::result::Result<Self, __D::Error>
113                where
114                    __D: _serde::Deserializer<'de>,
115                {
116                    _serde::Deserializer::deserialize_key(__deserializer, __FieldVisitor)
117                }
118            }
119            struct __hkDescriptionAttributeVisitor<'de> {
120                marker: _serde::__private::PhantomData<hkDescriptionAttribute<'de>>,
121                lifetime: _serde::__private::PhantomData<&'de ()>,
122            }
123            #[allow(clippy::match_single_binding)]
124            #[allow(clippy::reversed_empty_ranges)]
125            #[allow(clippy::single_match)]
126            impl<'de> _serde::de::Visitor<'de> for __hkDescriptionAttributeVisitor<'de> {
127                type Value = hkDescriptionAttribute<'de>;
128                fn expecting(
129                    &self,
130                    __formatter: &mut core::fmt::Formatter,
131                ) -> core::fmt::Result {
132                    core::fmt::Formatter::write_str(
133                        __formatter,
134                        "struct hkDescriptionAttribute",
135                    )
136                }
137                fn visit_struct_for_bytes<__A>(
138                    self,
139                    mut __map: __A,
140                ) -> _serde::__private::Result<Self::Value, __A::Error>
141                where
142                    __A: _serde::de::MapAccess<'de>,
143                {
144                    let __ptr = __A::class_ptr(&mut __map);
145                    let mut m_string: _serde::__private::Option<CString<'de>> = _serde::__private::None;
146                    for i in 0..1usize {
147                        match i {
148                            0usize => {
149                                if _serde::__private::Option::is_some(&m_string) {
150                                    return _serde::__private::Err(
151                                        <__A::Error as _serde::de::Error>::duplicate_field("string"),
152                                    );
153                                }
154                                m_string = _serde::__private::Some(
155                                    match __A::next_value::<CString<'de>>(&mut __map) {
156                                        _serde::__private::Ok(__val) => __val,
157                                        _serde::__private::Err(__err) => {
158                                            return _serde::__private::Err(__err);
159                                        }
160                                    },
161                                );
162                            }
163                            _ => {}
164                        }
165                    }
166                    let m_string = match m_string {
167                        _serde::__private::Some(__field) => __field,
168                        _serde::__private::None => {
169                            return _serde::__private::Err(
170                                <__A::Error as _serde::de::Error>::missing_field("string"),
171                            );
172                        }
173                    };
174                    _serde::__private::Ok(hkDescriptionAttribute {
175                        __ptr,
176                        m_string,
177                    })
178                }
179                #[allow(clippy::manual_unwrap_or_default)]
180                fn visit_struct<__A>(
181                    self,
182                    mut __map: __A,
183                ) -> _serde::__private::Result<Self::Value, __A::Error>
184                where
185                    __A: _serde::de::MapAccess<'de>,
186                {
187                    let mut m_string: _serde::__private::Option<CString<'de>> = _serde::__private::None;
188                    while let _serde::__private::Some(__key) = {
189                        __A::next_key::<__Field>(&mut __map)?
190                    } {
191                        match __key {
192                            __Field::m_string => {
193                                #[cfg(
194                                    any(feature = "strict", feature = "ignore_duplicates")
195                                )]
196                                if _serde::__private::Option::is_some(&m_string) {
197                                    #[cfg(feature = "ignore_duplicates")]
198                                    {
199                                        __A::skip_value(&mut __map)?;
200                                        continue;
201                                    }
202                                    #[cfg(feature = "strict")]
203                                    return _serde::__private::Err(
204                                        <__A::Error as _serde::de::Error>::duplicate_field("string"),
205                                    );
206                                }
207                                m_string = _serde::__private::Some(
208                                    match __A::next_value::<CString<'de>>(&mut __map) {
209                                        _serde::__private::Ok(__val) => __val,
210                                        _serde::__private::Err(__err) => {
211                                            return _serde::__private::Err(__err);
212                                        }
213                                    },
214                                );
215                            }
216                            _ => __A::skip_value(&mut __map)?,
217                        }
218                    }
219                    let m_string = match m_string {
220                        _serde::__private::Some(__field) => __field,
221                        _serde::__private::None => {
222                            #[cfg(feature = "strict")]
223                            return _serde::__private::Err(
224                                <__A::Error as _serde::de::Error>::missing_field("string"),
225                            );
226                            #[cfg(not(feature = "strict"))] Default::default()
227                        }
228                    };
229                    let __ptr = __A::class_ptr(&mut __map);
230                    _serde::__private::Ok(hkDescriptionAttribute {
231                        __ptr,
232                        m_string,
233                    })
234                }
235            }
236            const FIELDS: &[&str] = &["string"];
237            _serde::Deserializer::deserialize_struct(
238                deserializer,
239                "hkDescriptionAttribute",
240                FIELDS,
241                __hkDescriptionAttributeVisitor {
242                    marker: _serde::__private::PhantomData::<hkDescriptionAttribute>,
243                    lifetime: _serde::__private::PhantomData,
244                },
245            )
246        }
247    }
248};