Skip to main content

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