Skip to main content

fidl_next_common_fuchsia_hardware_rpmb/
fidl_next_common_fuchsia_hardware_rpmb.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 EmmcDeviceInfo {
10        pub cid: [u8; 16],
11
12        pub rpmb_size: u8,
13
14        pub reliable_write_sector_count: u8,
15    }
16
17    unsafe impl<___E> ::fidl_next::Encode<crate::wire::EmmcDeviceInfo, ___E> for EmmcDeviceInfo
18    where
19        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
20    {
21        const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self, crate::wire::EmmcDeviceInfo> = unsafe {
22            ::fidl_next::CopyOptimization::enable_if(
23                true && <[u8; 16] as ::fidl_next::Encode<[u8; 16], ___E>>::COPY_OPTIMIZATION
24                    .is_enabled()
25                    && <u8 as ::fidl_next::Encode<u8, ___E>>::COPY_OPTIMIZATION.is_enabled()
26                    && <u8 as ::fidl_next::Encode<u8, ___E>>::COPY_OPTIMIZATION.is_enabled(),
27            )
28        };
29
30        #[inline]
31        fn encode(
32            self,
33            encoder_: &mut ___E,
34            out_: &mut ::core::mem::MaybeUninit<crate::wire::EmmcDeviceInfo>,
35            _: (),
36        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
37            ::fidl_next::munge! {
38                let crate::wire::EmmcDeviceInfo {
39                    cid,
40                    rpmb_size,
41                    reliable_write_sector_count,
42
43                } = out_;
44            }
45
46            ::fidl_next::Encode::encode(self.cid, encoder_, cid, ())?;
47
48            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(cid.as_mut_ptr()) };
49
50            ::fidl_next::Encode::encode(self.rpmb_size, encoder_, rpmb_size, ())?;
51
52            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(rpmb_size.as_mut_ptr()) };
53
54            ::fidl_next::Encode::encode(
55                self.reliable_write_sector_count,
56                encoder_,
57                reliable_write_sector_count,
58                (),
59            )?;
60
61            let mut _field = unsafe {
62                ::fidl_next::Slot::new_unchecked(reliable_write_sector_count.as_mut_ptr())
63            };
64
65            Ok(())
66        }
67    }
68
69    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::EmmcDeviceInfo, ___E> for &'a EmmcDeviceInfo
70    where
71        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
72    {
73        #[inline]
74        fn encode(
75            self,
76            encoder_: &mut ___E,
77            out_: &mut ::core::mem::MaybeUninit<crate::wire::EmmcDeviceInfo>,
78            _: (),
79        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
80            ::fidl_next::munge! {
81                let crate::wire::EmmcDeviceInfo {
82                    cid,
83                    rpmb_size,
84                    reliable_write_sector_count,
85
86                } = out_;
87            }
88
89            ::fidl_next::Encode::encode(&self.cid, encoder_, cid, ())?;
90
91            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(cid.as_mut_ptr()) };
92
93            ::fidl_next::Encode::encode(&self.rpmb_size, encoder_, rpmb_size, ())?;
94
95            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(rpmb_size.as_mut_ptr()) };
96
97            ::fidl_next::Encode::encode(
98                &self.reliable_write_sector_count,
99                encoder_,
100                reliable_write_sector_count,
101                (),
102            )?;
103
104            let mut _field = unsafe {
105                ::fidl_next::Slot::new_unchecked(reliable_write_sector_count.as_mut_ptr())
106            };
107
108            Ok(())
109        }
110    }
111
112    unsafe impl<___E>
113        ::fidl_next::EncodeOption<
114            ::fidl_next::wire::Box<'static, crate::wire::EmmcDeviceInfo>,
115            ___E,
116        > for EmmcDeviceInfo
117    where
118        ___E: ::fidl_next::Encoder + ?Sized,
119        EmmcDeviceInfo: ::fidl_next::Encode<crate::wire::EmmcDeviceInfo, ___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::EmmcDeviceInfo>,
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    unsafe impl<'a, ___E>
142        ::fidl_next::EncodeOption<
143            ::fidl_next::wire::Box<'static, crate::wire::EmmcDeviceInfo>,
144            ___E,
145        > for &'a EmmcDeviceInfo
146    where
147        ___E: ::fidl_next::Encoder + ?Sized,
148        &'a EmmcDeviceInfo: ::fidl_next::Encode<crate::wire::EmmcDeviceInfo, ___E>,
149    {
150        #[inline]
151        fn encode_option(
152            this: ::core::option::Option<Self>,
153            encoder: &mut ___E,
154            out: &mut ::core::mem::MaybeUninit<
155                ::fidl_next::wire::Box<'static, crate::wire::EmmcDeviceInfo>,
156            >,
157            _: (),
158        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
159            if let Some(inner) = this {
160                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
161                ::fidl_next::wire::Box::encode_present(out);
162            } else {
163                ::fidl_next::wire::Box::encode_absent(out);
164            }
165
166            Ok(())
167        }
168    }
169
170    impl ::fidl_next::FromWire<crate::wire::EmmcDeviceInfo> for EmmcDeviceInfo {
171        const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<crate::wire::EmmcDeviceInfo, Self> = unsafe {
172            ::fidl_next::CopyOptimization::enable_if(
173                true && <[u8; 16] as ::fidl_next::FromWire<[u8; 16]>>::COPY_OPTIMIZATION
174                    .is_enabled()
175                    && <u8 as ::fidl_next::FromWire<u8>>::COPY_OPTIMIZATION.is_enabled()
176                    && <u8 as ::fidl_next::FromWire<u8>>::COPY_OPTIMIZATION.is_enabled(),
177            )
178        };
179
180        #[inline]
181        fn from_wire(wire: crate::wire::EmmcDeviceInfo) -> Self {
182            Self {
183                cid: ::fidl_next::FromWire::from_wire(wire.cid),
184
185                rpmb_size: ::fidl_next::FromWire::from_wire(wire.rpmb_size),
186
187                reliable_write_sector_count: ::fidl_next::FromWire::from_wire(
188                    wire.reliable_write_sector_count,
189                ),
190            }
191        }
192    }
193
194    impl ::fidl_next::FromWireRef<crate::wire::EmmcDeviceInfo> for EmmcDeviceInfo {
195        #[inline]
196        fn from_wire_ref(wire: &crate::wire::EmmcDeviceInfo) -> Self {
197            Self {
198                cid: ::fidl_next::FromWireRef::from_wire_ref(&wire.cid),
199
200                rpmb_size: ::fidl_next::FromWireRef::from_wire_ref(&wire.rpmb_size),
201
202                reliable_write_sector_count: ::fidl_next::FromWireRef::from_wire_ref(
203                    &wire.reliable_write_sector_count,
204                ),
205            }
206        }
207    }
208
209    #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
210    pub enum DeviceInfo {
211        EmmcInfo(crate::natural::EmmcDeviceInfo),
212
213        UnknownOrdinal_(u64),
214    }
215
216    impl DeviceInfo {
217        pub fn is_unknown(&self) -> bool {
218            #[allow(unreachable_patterns)]
219            match self {
220                Self::UnknownOrdinal_(_) => true,
221                _ => false,
222            }
223        }
224    }
225
226    unsafe impl<___E> ::fidl_next::Encode<crate::wire::DeviceInfo<'static>, ___E> for DeviceInfo
227    where
228        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
229        ___E: ::fidl_next::Encoder,
230    {
231        #[inline]
232        fn encode(
233            self,
234            encoder: &mut ___E,
235            out: &mut ::core::mem::MaybeUninit<crate::wire::DeviceInfo<'static>>,
236            _: (),
237        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
238            ::fidl_next::munge!(let crate::wire::DeviceInfo { raw, _phantom: _ } = out);
239
240            match self {
241                Self::EmmcInfo(value) => ::fidl_next::wire::Union::encode_as::<
242                    ___E,
243                    crate::wire::EmmcDeviceInfo,
244                >(value, 1, encoder, raw, ())?,
245
246                Self::UnknownOrdinal_(ordinal) => {
247                    return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize));
248                }
249            }
250
251            Ok(())
252        }
253    }
254
255    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DeviceInfo<'static>, ___E> for &'a DeviceInfo
256    where
257        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
258        ___E: ::fidl_next::Encoder,
259    {
260        #[inline]
261        fn encode(
262            self,
263            encoder: &mut ___E,
264            out: &mut ::core::mem::MaybeUninit<crate::wire::DeviceInfo<'static>>,
265            _: (),
266        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
267            ::fidl_next::munge!(let crate::wire::DeviceInfo { raw, _phantom: _ } = out);
268
269            match self {
270                DeviceInfo::EmmcInfo(value) => ::fidl_next::wire::Union::encode_as::<
271                    ___E,
272                    crate::wire::EmmcDeviceInfo,
273                >(value, 1, encoder, raw, ())?,
274
275                DeviceInfo::UnknownOrdinal_(ordinal) => {
276                    return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize));
277                }
278            }
279
280            Ok(())
281        }
282    }
283
284    unsafe impl<___E> ::fidl_next::EncodeOption<crate::wire_optional::DeviceInfo<'static>, ___E>
285        for DeviceInfo
286    where
287        ___E: ?Sized,
288        DeviceInfo: ::fidl_next::Encode<crate::wire::DeviceInfo<'static>, ___E>,
289    {
290        #[inline]
291        fn encode_option(
292            this: ::core::option::Option<Self>,
293            encoder: &mut ___E,
294            out: &mut ::core::mem::MaybeUninit<crate::wire_optional::DeviceInfo<'static>>,
295            _: (),
296        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
297            ::fidl_next::munge!(let crate::wire_optional::DeviceInfo { raw, _phantom: _ } = &mut *out);
298
299            if let Some(inner) = this {
300                let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
301                ::fidl_next::Encode::encode(inner, encoder, value_out, ())?;
302            } else {
303                ::fidl_next::wire::Union::encode_absent(raw);
304            }
305
306            Ok(())
307        }
308    }
309
310    unsafe impl<'a, ___E> ::fidl_next::EncodeOption<crate::wire_optional::DeviceInfo<'static>, ___E>
311        for &'a DeviceInfo
312    where
313        ___E: ?Sized,
314        &'a DeviceInfo: ::fidl_next::Encode<crate::wire::DeviceInfo<'static>, ___E>,
315    {
316        #[inline]
317        fn encode_option(
318            this: ::core::option::Option<Self>,
319            encoder: &mut ___E,
320            out: &mut ::core::mem::MaybeUninit<crate::wire_optional::DeviceInfo<'static>>,
321            _: (),
322        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
323            ::fidl_next::munge!(let crate::wire_optional::DeviceInfo { raw, _phantom: _ } = &mut *out);
324
325            if let Some(inner) = this {
326                let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
327                ::fidl_next::Encode::encode(inner, encoder, value_out, ())?;
328            } else {
329                ::fidl_next::wire::Union::encode_absent(raw);
330            }
331
332            Ok(())
333        }
334    }
335
336    impl<'de> ::fidl_next::FromWire<crate::wire::DeviceInfo<'de>> for DeviceInfo {
337        #[inline]
338        fn from_wire(wire: crate::wire::DeviceInfo<'de>) -> Self {
339            let wire = ::core::mem::ManuallyDrop::new(wire);
340            match wire.raw.ordinal() {
341                1 => Self::EmmcInfo(::fidl_next::FromWire::from_wire(unsafe {
342                    wire.raw.get().read_unchecked::<crate::wire::EmmcDeviceInfo>()
343                })),
344
345                ord => return Self::UnknownOrdinal_(ord as u64),
346            }
347        }
348    }
349
350    impl<'de> ::fidl_next::FromWireRef<crate::wire::DeviceInfo<'de>> for DeviceInfo {
351        #[inline]
352        fn from_wire_ref(wire: &crate::wire::DeviceInfo<'de>) -> Self {
353            match wire.raw.ordinal() {
354                1 => Self::EmmcInfo(::fidl_next::FromWireRef::from_wire_ref(unsafe {
355                    wire.raw.get().deref_unchecked::<crate::wire::EmmcDeviceInfo>()
356                })),
357
358                ord => return Self::UnknownOrdinal_(ord as u64),
359            }
360        }
361    }
362
363    impl<'de> ::fidl_next::FromWireOption<crate::wire_optional::DeviceInfo<'de>> for DeviceInfo {
364        #[inline]
365        fn from_wire_option(
366            wire: crate::wire_optional::DeviceInfo<'de>,
367        ) -> ::core::option::Option<Self> {
368            if let Some(inner) = wire.into_option() {
369                Some(::fidl_next::FromWire::from_wire(inner))
370            } else {
371                None
372            }
373        }
374    }
375
376    impl<'de> ::fidl_next::FromWireOption<crate::wire_optional::DeviceInfo<'de>> for Box<DeviceInfo> {
377        #[inline]
378        fn from_wire_option(
379            wire: crate::wire_optional::DeviceInfo<'de>,
380        ) -> ::core::option::Option<Self> {
381            <
382            DeviceInfo as ::fidl_next::FromWireOption<crate::wire_optional::DeviceInfo<'de>>
383        >::from_wire_option(wire).map(Box::new)
384        }
385    }
386
387    impl<'de> ::fidl_next::FromWireOptionRef<crate::wire_optional::DeviceInfo<'de>>
388        for Box<DeviceInfo>
389    {
390        #[inline]
391        fn from_wire_option_ref(
392            wire: &crate::wire_optional::DeviceInfo<'de>,
393        ) -> ::core::option::Option<Self> {
394            if let Some(inner) = wire.as_ref() {
395                Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner)))
396            } else {
397                None
398            }
399        }
400    }
401
402    #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
403    pub struct RpmbGetDeviceInfoResponse {
404        pub info: crate::natural::DeviceInfo,
405    }
406
407    unsafe impl<___E> ::fidl_next::Encode<crate::wire::RpmbGetDeviceInfoResponse<'static>, ___E>
408        for RpmbGetDeviceInfoResponse
409    where
410        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
411        ___E: ::fidl_next::Encoder,
412    {
413        #[inline]
414        fn encode(
415            self,
416            encoder_: &mut ___E,
417            out_: &mut ::core::mem::MaybeUninit<crate::wire::RpmbGetDeviceInfoResponse<'static>>,
418            _: (),
419        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
420            ::fidl_next::munge! {
421                let crate::wire::RpmbGetDeviceInfoResponse {
422                    info,
423
424                } = out_;
425            }
426
427            ::fidl_next::Encode::encode(self.info, encoder_, info, ())?;
428
429            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(info.as_mut_ptr()) };
430
431            Ok(())
432        }
433    }
434
435    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::RpmbGetDeviceInfoResponse<'static>, ___E>
436        for &'a RpmbGetDeviceInfoResponse
437    where
438        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
439        ___E: ::fidl_next::Encoder,
440    {
441        #[inline]
442        fn encode(
443            self,
444            encoder_: &mut ___E,
445            out_: &mut ::core::mem::MaybeUninit<crate::wire::RpmbGetDeviceInfoResponse<'static>>,
446            _: (),
447        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
448            ::fidl_next::munge! {
449                let crate::wire::RpmbGetDeviceInfoResponse {
450                    info,
451
452                } = out_;
453            }
454
455            ::fidl_next::Encode::encode(&self.info, encoder_, info, ())?;
456
457            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(info.as_mut_ptr()) };
458
459            Ok(())
460        }
461    }
462
463    unsafe impl<___E>
464        ::fidl_next::EncodeOption<
465            ::fidl_next::wire::Box<'static, crate::wire::RpmbGetDeviceInfoResponse<'static>>,
466            ___E,
467        > for RpmbGetDeviceInfoResponse
468    where
469        ___E: ::fidl_next::Encoder + ?Sized,
470        RpmbGetDeviceInfoResponse:
471            ::fidl_next::Encode<crate::wire::RpmbGetDeviceInfoResponse<'static>, ___E>,
472    {
473        #[inline]
474        fn encode_option(
475            this: ::core::option::Option<Self>,
476            encoder: &mut ___E,
477            out: &mut ::core::mem::MaybeUninit<
478                ::fidl_next::wire::Box<'static, crate::wire::RpmbGetDeviceInfoResponse<'static>>,
479            >,
480            _: (),
481        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
482            if let Some(inner) = this {
483                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
484                ::fidl_next::wire::Box::encode_present(out);
485            } else {
486                ::fidl_next::wire::Box::encode_absent(out);
487            }
488
489            Ok(())
490        }
491    }
492
493    unsafe impl<'a, ___E>
494        ::fidl_next::EncodeOption<
495            ::fidl_next::wire::Box<'static, crate::wire::RpmbGetDeviceInfoResponse<'static>>,
496            ___E,
497        > for &'a RpmbGetDeviceInfoResponse
498    where
499        ___E: ::fidl_next::Encoder + ?Sized,
500        &'a RpmbGetDeviceInfoResponse:
501            ::fidl_next::Encode<crate::wire::RpmbGetDeviceInfoResponse<'static>, ___E>,
502    {
503        #[inline]
504        fn encode_option(
505            this: ::core::option::Option<Self>,
506            encoder: &mut ___E,
507            out: &mut ::core::mem::MaybeUninit<
508                ::fidl_next::wire::Box<'static, crate::wire::RpmbGetDeviceInfoResponse<'static>>,
509            >,
510            _: (),
511        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
512            if let Some(inner) = this {
513                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
514                ::fidl_next::wire::Box::encode_present(out);
515            } else {
516                ::fidl_next::wire::Box::encode_absent(out);
517            }
518
519            Ok(())
520        }
521    }
522
523    impl<'de> ::fidl_next::FromWire<crate::wire::RpmbGetDeviceInfoResponse<'de>>
524        for RpmbGetDeviceInfoResponse
525    {
526        #[inline]
527        fn from_wire(wire: crate::wire::RpmbGetDeviceInfoResponse<'de>) -> Self {
528            Self { info: ::fidl_next::FromWire::from_wire(wire.info) }
529        }
530    }
531
532    impl<'de> ::fidl_next::FromWireRef<crate::wire::RpmbGetDeviceInfoResponse<'de>>
533        for RpmbGetDeviceInfoResponse
534    {
535        #[inline]
536        fn from_wire_ref(wire: &crate::wire::RpmbGetDeviceInfoResponse<'de>) -> Self {
537            Self { info: ::fidl_next::FromWireRef::from_wire_ref(&wire.info) }
538        }
539    }
540
541    pub type RpmbRequestResponse = ();
542}
543
544pub mod wire {
545
546    /// The wire type corresponding to [`EmmcDeviceInfo`].
547    #[derive(Clone, Debug)]
548    #[repr(C)]
549    pub struct EmmcDeviceInfo {
550        pub cid: [u8; 16],
551
552        pub rpmb_size: u8,
553
554        pub reliable_write_sector_count: u8,
555    }
556
557    static_assertions::const_assert_eq!(std::mem::size_of::<EmmcDeviceInfo>(), 18);
558    static_assertions::const_assert_eq!(std::mem::align_of::<EmmcDeviceInfo>(), 1);
559
560    static_assertions::const_assert_eq!(std::mem::offset_of!(EmmcDeviceInfo, cid), 0);
561
562    static_assertions::const_assert_eq!(std::mem::offset_of!(EmmcDeviceInfo, rpmb_size), 16);
563
564    static_assertions::const_assert_eq!(
565        std::mem::offset_of!(EmmcDeviceInfo, reliable_write_sector_count),
566        17
567    );
568
569    impl ::fidl_next::Constrained for EmmcDeviceInfo {
570        type Constraint = ();
571
572        fn validate(
573            _: ::fidl_next::Slot<'_, Self>,
574            _: Self::Constraint,
575        ) -> Result<(), ::fidl_next::ValidationError> {
576            Ok(())
577        }
578    }
579
580    unsafe impl ::fidl_next::Wire for EmmcDeviceInfo {
581        type Narrowed<'de> = EmmcDeviceInfo;
582
583        #[inline]
584        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
585            ::fidl_next::munge! {
586                let Self {
587                    cid,
588                    rpmb_size,
589                    reliable_write_sector_count,
590
591                } = &mut *out_;
592            }
593
594            ::fidl_next::Wire::zero_padding(cid);
595
596            ::fidl_next::Wire::zero_padding(rpmb_size);
597
598            ::fidl_next::Wire::zero_padding(reliable_write_sector_count);
599        }
600    }
601
602    unsafe impl<___D> ::fidl_next::Decode<___D> for EmmcDeviceInfo
603    where
604        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
605    {
606        fn decode(
607            slot_: ::fidl_next::Slot<'_, Self>,
608            decoder_: &mut ___D,
609            _: (),
610        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
611            ::fidl_next::munge! {
612                let Self {
613                    mut cid,
614                    mut rpmb_size,
615                    mut reliable_write_sector_count,
616
617                } = slot_;
618            }
619
620            let _field = cid.as_mut();
621
622            ::fidl_next::Decode::decode(cid.as_mut(), decoder_, ())?;
623
624            let _field = rpmb_size.as_mut();
625
626            ::fidl_next::Decode::decode(rpmb_size.as_mut(), decoder_, ())?;
627
628            let _field = reliable_write_sector_count.as_mut();
629
630            ::fidl_next::Decode::decode(reliable_write_sector_count.as_mut(), decoder_, ())?;
631
632            Ok(())
633        }
634    }
635
636    impl ::fidl_next::IntoNatural for EmmcDeviceInfo {
637        type Natural = crate::natural::EmmcDeviceInfo;
638    }
639
640    /// The wire type corresponding to [`DeviceInfo`].
641    #[repr(transparent)]
642    pub struct DeviceInfo<'de> {
643        pub(crate) raw: ::fidl_next::wire::Union,
644        pub(crate) _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
645    }
646
647    impl<'de> Drop for DeviceInfo<'de> {
648        fn drop(&mut self) {
649            match self.raw.ordinal() {
650                1 => {
651                    let _ =
652                        unsafe { self.raw.get().read_unchecked::<crate::wire::EmmcDeviceInfo>() };
653                }
654
655                _ => (),
656            }
657        }
658    }
659
660    impl ::fidl_next::Constrained for DeviceInfo<'_> {
661        type Constraint = ();
662
663        fn validate(
664            _: ::fidl_next::Slot<'_, Self>,
665            _: Self::Constraint,
666        ) -> Result<(), ::fidl_next::ValidationError> {
667            Ok(())
668        }
669    }
670
671    unsafe impl ::fidl_next::Wire for DeviceInfo<'static> {
672        type Narrowed<'de> = DeviceInfo<'de>;
673
674        #[inline]
675        fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
676            ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
677            ::fidl_next::wire::Union::zero_padding(raw);
678        }
679    }
680
681    pub mod device_info {
682        pub enum Ref<'de> {
683            EmmcInfo(&'de crate::wire::EmmcDeviceInfo),
684
685            UnknownOrdinal_(u64),
686        }
687    }
688
689    impl<'de> DeviceInfo<'de> {
690        pub fn as_ref(&self) -> crate::wire::device_info::Ref<'_> {
691            match self.raw.ordinal() {
692                1 => crate::wire::device_info::Ref::EmmcInfo(unsafe {
693                    self.raw.get().deref_unchecked::<crate::wire::EmmcDeviceInfo>()
694                }),
695
696                unknown => crate::wire::device_info::Ref::UnknownOrdinal_(unknown),
697            }
698        }
699    }
700
701    unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for DeviceInfo<'de>
702    where
703        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
704        ___D: ::fidl_next::Decoder<'de>,
705    {
706        fn decode(
707            mut slot: ::fidl_next::Slot<'_, Self>,
708            decoder: &mut ___D,
709            _: (),
710        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
711            ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
712            match ::fidl_next::wire::Union::encoded_ordinal(raw.as_mut()) {
713                1 => ::fidl_next::wire::Union::decode_as::<___D, crate::wire::EmmcDeviceInfo>(
714                    raw,
715                    decoder,
716                    (),
717                )?,
718
719                _ => ::fidl_next::wire::Union::decode_unknown(raw, decoder)?,
720            }
721
722            Ok(())
723        }
724    }
725
726    impl<'de> ::core::fmt::Debug for DeviceInfo<'de> {
727        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
728            match self.raw.ordinal() {
729                1 => unsafe {
730                    self.raw.get().deref_unchecked::<crate::wire::EmmcDeviceInfo>().fmt(f)
731                },
732                _ => unsafe { ::core::hint::unreachable_unchecked() },
733            }
734        }
735    }
736
737    impl<'de> ::fidl_next::IntoNatural for DeviceInfo<'de> {
738        type Natural = crate::natural::DeviceInfo;
739    }
740
741    /// The wire type corresponding to [`RpmbGetDeviceInfoResponse`].
742    #[derive(Debug)]
743    #[repr(C)]
744    pub struct RpmbGetDeviceInfoResponse<'de> {
745        pub info: crate::wire::DeviceInfo<'de>,
746    }
747
748    static_assertions::const_assert_eq!(std::mem::size_of::<RpmbGetDeviceInfoResponse<'_>>(), 16);
749    static_assertions::const_assert_eq!(std::mem::align_of::<RpmbGetDeviceInfoResponse<'_>>(), 8);
750
751    static_assertions::const_assert_eq!(
752        std::mem::offset_of!(RpmbGetDeviceInfoResponse<'_>, info),
753        0
754    );
755
756    impl ::fidl_next::Constrained for RpmbGetDeviceInfoResponse<'_> {
757        type Constraint = ();
758
759        fn validate(
760            _: ::fidl_next::Slot<'_, Self>,
761            _: Self::Constraint,
762        ) -> Result<(), ::fidl_next::ValidationError> {
763            Ok(())
764        }
765    }
766
767    unsafe impl ::fidl_next::Wire for RpmbGetDeviceInfoResponse<'static> {
768        type Narrowed<'de> = RpmbGetDeviceInfoResponse<'de>;
769
770        #[inline]
771        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
772            ::fidl_next::munge! {
773                let Self {
774                    info,
775
776                } = &mut *out_;
777            }
778
779            ::fidl_next::Wire::zero_padding(info);
780        }
781    }
782
783    unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for RpmbGetDeviceInfoResponse<'de>
784    where
785        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
786        ___D: ::fidl_next::Decoder<'de>,
787    {
788        fn decode(
789            slot_: ::fidl_next::Slot<'_, Self>,
790            decoder_: &mut ___D,
791            _: (),
792        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
793            ::fidl_next::munge! {
794                let Self {
795                    mut info,
796
797                } = slot_;
798            }
799
800            let _field = info.as_mut();
801
802            ::fidl_next::Decode::decode(info.as_mut(), decoder_, ())?;
803
804            Ok(())
805        }
806    }
807
808    impl<'de> ::fidl_next::IntoNatural for RpmbGetDeviceInfoResponse<'de> {
809        type Natural = crate::natural::RpmbGetDeviceInfoResponse;
810    }
811
812    /// The wire type corresponding to [`RpmbRequestResponse`].
813    pub type RpmbRequestResponse = ::fidl_next::wire::Unit;
814}
815
816pub mod wire_optional {
817
818    #[repr(transparent)]
819    pub struct DeviceInfo<'de> {
820        pub(crate) raw: ::fidl_next::wire::Union,
821        pub(crate) _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
822    }
823
824    impl ::fidl_next::Constrained for DeviceInfo<'_> {
825        type Constraint = ();
826
827        fn validate(
828            _: ::fidl_next::Slot<'_, Self>,
829            _: Self::Constraint,
830        ) -> Result<(), ::fidl_next::ValidationError> {
831            Ok(())
832        }
833    }
834
835    unsafe impl ::fidl_next::Wire for DeviceInfo<'static> {
836        type Narrowed<'de> = DeviceInfo<'de>;
837
838        #[inline]
839        fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
840            ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
841            ::fidl_next::wire::Union::zero_padding(raw);
842        }
843    }
844
845    impl<'de> DeviceInfo<'de> {
846        pub fn is_some(&self) -> bool {
847            self.raw.is_some()
848        }
849
850        pub fn is_none(&self) -> bool {
851            self.raw.is_none()
852        }
853
854        pub fn as_ref(&self) -> ::core::option::Option<&crate::wire::DeviceInfo<'de>> {
855            if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None }
856        }
857
858        pub fn into_option(self) -> ::core::option::Option<crate::wire::DeviceInfo<'de>> {
859            if self.is_some() {
860                Some(crate::wire::DeviceInfo {
861                    raw: self.raw,
862                    _phantom: ::core::marker::PhantomData,
863                })
864            } else {
865                None
866            }
867        }
868    }
869
870    unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for DeviceInfo<'de>
871    where
872        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
873        ___D: ::fidl_next::Decoder<'de>,
874    {
875        fn decode(
876            mut slot: ::fidl_next::Slot<'_, Self>,
877            decoder: &mut ___D,
878            _: (),
879        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
880            ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
881            match ::fidl_next::wire::Union::encoded_ordinal(raw.as_mut()) {
882                1 => ::fidl_next::wire::Union::decode_as::<___D, crate::wire::EmmcDeviceInfo>(
883                    raw,
884                    decoder,
885                    (),
886                )?,
887
888                0 => ::fidl_next::wire::Union::decode_absent(raw)?,
889                _ => ::fidl_next::wire::Union::decode_unknown(raw, decoder)?,
890            }
891
892            Ok(())
893        }
894    }
895
896    impl<'de> ::core::fmt::Debug for DeviceInfo<'de> {
897        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
898            self.as_ref().fmt(f)
899        }
900    }
901
902    impl<'de> ::fidl_next::IntoNatural for DeviceInfo<'de> {
903        type Natural = ::core::option::Option<crate::natural::DeviceInfo>;
904    }
905}
906
907pub mod generic {
908
909    /// The generic type corresponding to [`EmmcDeviceInfo`].
910    pub struct EmmcDeviceInfo<T0, T1, T2> {
911        pub cid: T0,
912
913        pub rpmb_size: T1,
914
915        pub reliable_write_sector_count: T2,
916    }
917
918    unsafe impl<___E, T0, T1, T2> ::fidl_next::Encode<crate::wire::EmmcDeviceInfo, ___E>
919        for EmmcDeviceInfo<T0, T1, T2>
920    where
921        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
922        T0: ::fidl_next::Encode<[u8; 16], ___E>,
923        T1: ::fidl_next::Encode<u8, ___E>,
924        T2: ::fidl_next::Encode<u8, ___E>,
925    {
926        #[inline]
927        fn encode(
928            self,
929            encoder_: &mut ___E,
930            out_: &mut ::core::mem::MaybeUninit<crate::wire::EmmcDeviceInfo>,
931            _: (),
932        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
933            ::fidl_next::munge! {
934                let crate::wire::EmmcDeviceInfo {
935                    cid,
936                    rpmb_size,
937                    reliable_write_sector_count,
938
939                } = out_;
940            }
941
942            ::fidl_next::Encode::encode(self.cid, encoder_, cid, ())?;
943
944            ::fidl_next::Encode::encode(self.rpmb_size, encoder_, rpmb_size, ())?;
945
946            ::fidl_next::Encode::encode(
947                self.reliable_write_sector_count,
948                encoder_,
949                reliable_write_sector_count,
950                (),
951            )?;
952
953            Ok(())
954        }
955    }
956
957    /// The generic type corresponding to [`RpmbGetDeviceInfoResponse`].
958    pub struct RpmbGetDeviceInfoResponse<T0> {
959        pub info: T0,
960    }
961
962    unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::RpmbGetDeviceInfoResponse<'static>, ___E>
963        for RpmbGetDeviceInfoResponse<T0>
964    where
965        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
966        ___E: ::fidl_next::Encoder,
967        T0: ::fidl_next::Encode<crate::wire::DeviceInfo<'static>, ___E>,
968    {
969        #[inline]
970        fn encode(
971            self,
972            encoder_: &mut ___E,
973            out_: &mut ::core::mem::MaybeUninit<crate::wire::RpmbGetDeviceInfoResponse<'static>>,
974            _: (),
975        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
976            ::fidl_next::munge! {
977                let crate::wire::RpmbGetDeviceInfoResponse {
978                    info,
979
980                } = out_;
981            }
982
983            ::fidl_next::Encode::encode(self.info, encoder_, info, ())?;
984
985            Ok(())
986        }
987    }
988
989    /// The generic type corresponding to [`RpmbRequestResponse`].
990    pub type RpmbRequestResponse = ();
991}
992
993pub use self::natural::*;
994
995#[doc = " The RPMB frame size in bytes.\n"]
996pub const FRAME_SIZE: u32 = 512 as u32;