fidl_next_common_fuchsia_examples_gizmo/
fidl_next_common_fuchsia_examples_gizmo.rs

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