Skip to main content

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