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