Skip to main content

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(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
69                    response,
70
71                } = out_;
72            }
73
74            ::fidl_next::Encode::encode(&self.response, encoder_, response, ())?;
75
76            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(response.as_mut_ptr()) };
77
78            Ok(())
79        }
80    }
81
82    unsafe impl<___E>
83        ::fidl_next::EncodeOption<
84            ::fidl_next::wire::Box<'static, crate::wire::DeviceGetHardwareIdResponse>,
85            ___E,
86        > for DeviceGetHardwareIdResponse
87    where
88        ___E: ::fidl_next::Encoder + ?Sized,
89        DeviceGetHardwareIdResponse:
90            ::fidl_next::Encode<crate::wire::DeviceGetHardwareIdResponse, ___E>,
91    {
92        #[inline]
93        fn encode_option(
94            this: ::core::option::Option<Self>,
95            encoder: &mut ___E,
96            out: &mut ::core::mem::MaybeUninit<
97                ::fidl_next::wire::Box<'static, crate::wire::DeviceGetHardwareIdResponse>,
98            >,
99            _: (),
100        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
101            if let Some(inner) = this {
102                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
103                ::fidl_next::wire::Box::encode_present(out);
104            } else {
105                ::fidl_next::wire::Box::encode_absent(out);
106            }
107
108            Ok(())
109        }
110    }
111
112    unsafe impl<'a, ___E>
113        ::fidl_next::EncodeOption<
114            ::fidl_next::wire::Box<'static, crate::wire::DeviceGetHardwareIdResponse>,
115            ___E,
116        > for &'a DeviceGetHardwareIdResponse
117    where
118        ___E: ::fidl_next::Encoder + ?Sized,
119        &'a DeviceGetHardwareIdResponse:
120            ::fidl_next::Encode<crate::wire::DeviceGetHardwareIdResponse, ___E>,
121    {
122        #[inline]
123        fn encode_option(
124            this: ::core::option::Option<Self>,
125            encoder: &mut ___E,
126            out: &mut ::core::mem::MaybeUninit<
127                ::fidl_next::wire::Box<'static, crate::wire::DeviceGetHardwareIdResponse>,
128            >,
129            _: (),
130        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
131            if let Some(inner) = this {
132                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
133                ::fidl_next::wire::Box::encode_present(out);
134            } else {
135                ::fidl_next::wire::Box::encode_absent(out);
136            }
137
138            Ok(())
139        }
140    }
141
142    impl ::fidl_next::FromWire<crate::wire::DeviceGetHardwareIdResponse>
143        for DeviceGetHardwareIdResponse
144    {
145        const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
146            crate::wire::DeviceGetHardwareIdResponse,
147            Self,
148        > = unsafe {
149            ::fidl_next::CopyOptimization::enable_if(
150                true
151                    && <u32 as ::fidl_next::FromWire<::fidl_next::wire::Uint32>>::COPY_OPTIMIZATION
152                        .is_enabled(),
153            )
154        };
155
156        #[inline]
157        fn from_wire(wire: crate::wire::DeviceGetHardwareIdResponse) -> Self {
158            Self { response: ::fidl_next::FromWire::from_wire(wire.response) }
159        }
160    }
161
162    impl ::fidl_next::FromWireRef<crate::wire::DeviceGetHardwareIdResponse>
163        for DeviceGetHardwareIdResponse
164    {
165        #[inline]
166        fn from_wire_ref(wire: &crate::wire::DeviceGetHardwareIdResponse) -> Self {
167            Self { response: ::fidl_next::FromWireRef::from_wire_ref(&wire.response) }
168        }
169    }
170}
171
172pub mod wire {
173
174    /// The wire type corresponding to [`DeviceGetHardwareIdResponse`].
175    #[derive(Clone, Debug)]
176    #[repr(C)]
177    pub struct DeviceGetHardwareIdResponse {
178        pub response: ::fidl_next::wire::Uint32,
179    }
180
181    static_assertions::const_assert_eq!(std::mem::size_of::<DeviceGetHardwareIdResponse>(), 4);
182    static_assertions::const_assert_eq!(std::mem::align_of::<DeviceGetHardwareIdResponse>(), 4);
183
184    static_assertions::const_assert_eq!(
185        std::mem::offset_of!(DeviceGetHardwareIdResponse, response),
186        0
187    );
188
189    impl ::fidl_next::Constrained for DeviceGetHardwareIdResponse {
190        type Constraint = ();
191
192        fn validate(
193            _: ::fidl_next::Slot<'_, Self>,
194            _: Self::Constraint,
195        ) -> Result<(), ::fidl_next::ValidationError> {
196            Ok(())
197        }
198    }
199
200    unsafe impl ::fidl_next::Wire for DeviceGetHardwareIdResponse {
201        type Narrowed<'de> = DeviceGetHardwareIdResponse;
202
203        #[inline]
204        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
205            ::fidl_next::munge! {
206                let Self {
207
208                    response,
209
210                } = &mut *out_;
211            }
212
213            ::fidl_next::Wire::zero_padding(response);
214        }
215    }
216
217    unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceGetHardwareIdResponse
218    where
219        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
220    {
221        fn decode(
222            slot_: ::fidl_next::Slot<'_, Self>,
223            decoder_: &mut ___D,
224            _: (),
225        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
226            ::fidl_next::munge! {
227                let Self {
228
229                    mut response,
230
231                } = slot_;
232            }
233
234            let _field = response.as_mut();
235
236            ::fidl_next::Decode::decode(response.as_mut(), decoder_, ())?;
237
238            Ok(())
239        }
240    }
241
242    impl ::fidl_next::IntoNatural for DeviceGetHardwareIdResponse {
243        type Natural = crate::natural::DeviceGetHardwareIdResponse;
244    }
245}
246
247pub mod wire_optional {}
248
249pub mod generic {
250
251    pub struct DeviceGetHardwareIdResponse<T0> {
252        pub response: T0,
253    }
254
255    unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceGetHardwareIdResponse, ___E>
256        for DeviceGetHardwareIdResponse<T0>
257    where
258        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
259        T0: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
260    {
261        #[inline]
262        fn encode(
263            self,
264            encoder_: &mut ___E,
265            out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetHardwareIdResponse>,
266            _: (),
267        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
268            ::fidl_next::munge! {
269                let crate::wire::DeviceGetHardwareIdResponse {
270
271                    response,
272
273                } = out_;
274            }
275
276            ::fidl_next::Encode::encode(self.response, encoder_, response, ())?;
277
278            Ok(())
279        }
280    }
281}
282
283pub use self::natural::*;
284
285/// Compatibility shims which mimic some API surfaces of the current Rust bindings.
286pub mod compat {
287
288    impl ::fidl_next::CompatFrom<crate::DeviceGetHardwareIdResponse>
289        for ::fidl_fuchsia_examples_gizmo::DeviceGetHardwareIdResponse
290    {
291        #[inline]
292        fn compat_from(value: crate::DeviceGetHardwareIdResponse) -> Self {
293            Self { response: ::fidl_next::CompatFrom::compat_from(value.response) }
294        }
295    }
296
297    impl ::fidl_next::CompatFrom<::fidl_fuchsia_examples_gizmo::DeviceGetHardwareIdResponse>
298        for crate::DeviceGetHardwareIdResponse
299    {
300        #[inline]
301        fn compat_from(value: ::fidl_fuchsia_examples_gizmo::DeviceGetHardwareIdResponse) -> Self {
302            Self { response: ::fidl_next::CompatFrom::compat_from(value.response) }
303        }
304    }
305}