fidl_next_common_fuchsia_examples_gizmo/
fidl_next_common_fuchsia_examples_gizmo.rs1#![warn(clippy::all)]
3#![allow(unused_parens, unused_variables, unused_mut, unused_imports, unreachable_code)]
4
5pub mod natural {
6
7 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
8 #[repr(C)]
9 pub struct DeviceGetHardwareIdResponse {
10 pub response: u32,
11 }
12
13 unsafe impl<___E> ::fidl_next::Encode<crate::wire::DeviceGetHardwareIdResponse, ___E>
14 for DeviceGetHardwareIdResponse
15 where
16 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
17 {
18 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
19 Self,
20 crate::wire::DeviceGetHardwareIdResponse,
21 > = unsafe {
22 ::fidl_next::CopyOptimization::enable_if(
23 true
24
25 && <
26 u32 as ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>
27 >::COPY_OPTIMIZATION.is_enabled()
28
29 )
30 };
31
32 #[inline]
33 fn encode(
34 self,
35 encoder_: &mut ___E,
36 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetHardwareIdResponse>,
37 _: (),
38 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
39 ::fidl_next::munge! {
40 let crate::wire::DeviceGetHardwareIdResponse {
41 response,
42
43 } = out_;
44 }
45
46 ::fidl_next::Encode::encode(self.response, encoder_, response, ())?;
47
48 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(response.as_mut_ptr()) };
49
50 Ok(())
51 }
52 }
53
54 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DeviceGetHardwareIdResponse, ___E>
55 for &'a DeviceGetHardwareIdResponse
56 where
57 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
58 {
59 #[inline]
60 fn encode(
61 self,
62 encoder_: &mut ___E,
63 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetHardwareIdResponse>,
64 _: (),
65 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
66 ::fidl_next::munge! {
67 let crate::wire::DeviceGetHardwareIdResponse {
68 response,
69
70 } = out_;
71 }
72
73 ::fidl_next::Encode::encode(&self.response, encoder_, response, ())?;
74
75 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(response.as_mut_ptr()) };
76
77 Ok(())
78 }
79 }
80
81 unsafe impl<___E>
82 ::fidl_next::EncodeOption<
83 ::fidl_next::wire::Box<'static, crate::wire::DeviceGetHardwareIdResponse>,
84 ___E,
85 > for DeviceGetHardwareIdResponse
86 where
87 ___E: ::fidl_next::Encoder + ?Sized,
88 DeviceGetHardwareIdResponse:
89 ::fidl_next::Encode<crate::wire::DeviceGetHardwareIdResponse, ___E>,
90 {
91 #[inline]
92 fn encode_option(
93 this: ::core::option::Option<Self>,
94 encoder: &mut ___E,
95 out: &mut ::core::mem::MaybeUninit<
96 ::fidl_next::wire::Box<'static, crate::wire::DeviceGetHardwareIdResponse>,
97 >,
98 _: (),
99 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
100 if let Some(inner) = this {
101 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
102 ::fidl_next::wire::Box::encode_present(out);
103 } else {
104 ::fidl_next::wire::Box::encode_absent(out);
105 }
106
107 Ok(())
108 }
109 }
110
111 unsafe impl<'a, ___E>
112 ::fidl_next::EncodeOption<
113 ::fidl_next::wire::Box<'static, crate::wire::DeviceGetHardwareIdResponse>,
114 ___E,
115 > for &'a DeviceGetHardwareIdResponse
116 where
117 ___E: ::fidl_next::Encoder + ?Sized,
118 &'a DeviceGetHardwareIdResponse:
119 ::fidl_next::Encode<crate::wire::DeviceGetHardwareIdResponse, ___E>,
120 {
121 #[inline]
122 fn encode_option(
123 this: ::core::option::Option<Self>,
124 encoder: &mut ___E,
125 out: &mut ::core::mem::MaybeUninit<
126 ::fidl_next::wire::Box<'static, crate::wire::DeviceGetHardwareIdResponse>,
127 >,
128 _: (),
129 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
130 if let Some(inner) = this {
131 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
132 ::fidl_next::wire::Box::encode_present(out);
133 } else {
134 ::fidl_next::wire::Box::encode_absent(out);
135 }
136
137 Ok(())
138 }
139 }
140
141 impl ::fidl_next::FromWire<crate::wire::DeviceGetHardwareIdResponse>
142 for DeviceGetHardwareIdResponse
143 {
144 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
145 crate::wire::DeviceGetHardwareIdResponse,
146 Self,
147 > = unsafe {
148 ::fidl_next::CopyOptimization::enable_if(
149 true
150 && <u32 as ::fidl_next::FromWire<::fidl_next::wire::Uint32>>::COPY_OPTIMIZATION
151 .is_enabled(),
152 )
153 };
154
155 #[inline]
156 fn from_wire(wire: crate::wire::DeviceGetHardwareIdResponse) -> Self {
157 Self { response: ::fidl_next::FromWire::from_wire(wire.response) }
158 }
159 }
160
161 impl ::fidl_next::FromWireRef<crate::wire::DeviceGetHardwareIdResponse>
162 for DeviceGetHardwareIdResponse
163 {
164 #[inline]
165 fn from_wire_ref(wire: &crate::wire::DeviceGetHardwareIdResponse) -> Self {
166 Self { response: ::fidl_next::FromWireRef::from_wire_ref(&wire.response) }
167 }
168 }
169}
170
171pub mod wire {
172
173 #[derive(Clone, Debug)]
175 #[repr(C)]
176 pub struct DeviceGetHardwareIdResponse {
177 pub response: ::fidl_next::wire::Uint32,
178 }
179
180 static_assertions::const_assert_eq!(std::mem::size_of::<DeviceGetHardwareIdResponse>(), 4);
181 static_assertions::const_assert_eq!(std::mem::align_of::<DeviceGetHardwareIdResponse>(), 4);
182
183 static_assertions::const_assert_eq!(
184 std::mem::offset_of!(DeviceGetHardwareIdResponse, response),
185 0
186 );
187
188 impl ::fidl_next::Constrained for DeviceGetHardwareIdResponse {
189 type Constraint = ();
190
191 fn validate(
192 _: ::fidl_next::Slot<'_, Self>,
193 _: Self::Constraint,
194 ) -> Result<(), ::fidl_next::ValidationError> {
195 Ok(())
196 }
197 }
198
199 unsafe impl ::fidl_next::Wire for DeviceGetHardwareIdResponse {
200 type Narrowed<'de> = DeviceGetHardwareIdResponse;
201
202 #[inline]
203 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
204 ::fidl_next::munge! {
205 let Self {
206 response,
207
208 } = &mut *out_;
209 }
210
211 ::fidl_next::Wire::zero_padding(response);
212 }
213 }
214
215 unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceGetHardwareIdResponse
216 where
217 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
218 {
219 fn decode(
220 slot_: ::fidl_next::Slot<'_, Self>,
221 decoder_: &mut ___D,
222 _: (),
223 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
224 ::fidl_next::munge! {
225 let Self {
226 mut response,
227
228 } = slot_;
229 }
230
231 let _field = response.as_mut();
232
233 ::fidl_next::Decode::decode(response.as_mut(), decoder_, ())?;
234
235 Ok(())
236 }
237 }
238
239 impl ::fidl_next::IntoNatural for DeviceGetHardwareIdResponse {
240 type Natural = crate::natural::DeviceGetHardwareIdResponse;
241 }
242}
243
244pub mod wire_optional {}
245
246pub mod generic {
247
248 pub struct DeviceGetHardwareIdResponse<T0> {
250 pub response: T0,
251 }
252
253 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceGetHardwareIdResponse, ___E>
254 for DeviceGetHardwareIdResponse<T0>
255 where
256 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
257 T0: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
258 {
259 #[inline]
260 fn encode(
261 self,
262 encoder_: &mut ___E,
263 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetHardwareIdResponse>,
264 _: (),
265 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
266 ::fidl_next::munge! {
267 let crate::wire::DeviceGetHardwareIdResponse {
268 response,
269
270 } = out_;
271 }
272
273 ::fidl_next::Encode::encode(self.response, encoder_, response, ())?;
274
275 Ok(())
276 }
277 }
278}
279
280pub use self::natural::*;