1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11bitflags! {
12 #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
13 pub struct InterruptOptions: u32 {
14 const WAKEABLE = 1;
17 const TIMESTAMP_MONO = 2;
20 }
21}
22
23impl InterruptOptions {
24 #[inline(always)]
25 pub fn from_bits_allow_unknown(bits: u32) -> Self {
26 Self::from_bits_retain(bits)
27 }
28
29 #[inline(always)]
30 pub fn has_unknown_bits(&self) -> bool {
31 self.get_unknown_bits() != 0
32 }
33
34 #[inline(always)]
35 pub fn get_unknown_bits(&self) -> u32 {
36 self.bits() & !Self::all().bits()
37 }
38}
39
40#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
42#[repr(u32)]
43pub enum BufferMode {
44 Input = 0,
45 OutputLow = 1,
46 OutputHigh = 2,
47}
48
49impl BufferMode {
50 #[inline]
51 pub fn from_primitive(prim: u32) -> Option<Self> {
52 match prim {
53 0 => Some(Self::Input),
54 1 => Some(Self::OutputLow),
55 2 => Some(Self::OutputHigh),
56 _ => None,
57 }
58 }
59
60 #[inline]
61 pub const fn into_primitive(self) -> u32 {
62 self as u32
63 }
64}
65
66#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
67#[repr(u32)]
68pub enum InterruptMode {
69 EdgeLow = 0,
70 EdgeHigh = 1,
71 EdgeBoth = 2,
72 LevelLow = 3,
73 LevelHigh = 4,
74}
75
76impl InterruptMode {
77 #[inline]
78 pub fn from_primitive(prim: u32) -> Option<Self> {
79 match prim {
80 0 => Some(Self::EdgeLow),
81 1 => Some(Self::EdgeHigh),
82 2 => Some(Self::EdgeBoth),
83 3 => Some(Self::LevelLow),
84 4 => Some(Self::LevelHigh),
85 _ => None,
86 }
87 }
88
89 #[inline]
90 pub const fn into_primitive(self) -> u32 {
91 self as u32
92 }
93}
94
95#[derive(Clone, Debug, PartialEq)]
96pub struct GpioConfigureInterruptRequest {
97 pub config: InterruptConfiguration,
98}
99
100impl fidl::Persistable for GpioConfigureInterruptRequest {}
101
102#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
103pub struct GpioGetInterruptRequest {
104 pub options: InterruptOptions,
105}
106
107impl fidl::Persistable for GpioGetInterruptRequest {}
108
109#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
110pub struct GpioSetBufferModeRequest {
111 pub mode: BufferMode,
112}
113
114impl fidl::Persistable for GpioSetBufferModeRequest {}
115
116#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
117pub struct GpioReadResponse {
118 pub value: bool,
119}
120
121impl fidl::Persistable for GpioReadResponse {}
122
123#[derive(Clone, Debug, Default, PartialEq)]
124pub struct InterruptConfiguration {
125 pub mode: Option<InterruptMode>,
126 #[doc(hidden)]
127 pub __source_breaking: fidl::marker::SourceBreaking,
128}
129
130impl fidl::Persistable for InterruptConfiguration {}
131
132pub mod gpio_ordinals {
133 pub const READ: u64 = 0x5fdfe4816ed6a7b0;
134 pub const SET_BUFFER_MODE: u64 = 0x6c766846a5d634c3;
135 pub const GET_INTERRUPT: u64 = 0x6638c6b4471c7d05;
136 pub const CONFIGURE_INTERRUPT: u64 = 0x65a8a4db7d0f3ca3;
137 pub const RELEASE_INTERRUPT: u64 = 0x423a4009bfef9946;
138}
139
140mod internal {
141 use super::*;
142 unsafe impl fidl::encoding::TypeMarker for InterruptOptions {
143 type Owned = Self;
144
145 #[inline(always)]
146 fn inline_align(_context: fidl::encoding::Context) -> usize {
147 4
148 }
149
150 #[inline(always)]
151 fn inline_size(_context: fidl::encoding::Context) -> usize {
152 4
153 }
154 }
155
156 impl fidl::encoding::ValueTypeMarker for InterruptOptions {
157 type Borrowed<'a> = Self;
158 #[inline(always)]
159 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
160 *value
161 }
162 }
163
164 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
165 for InterruptOptions
166 {
167 #[inline]
168 unsafe fn encode(
169 self,
170 encoder: &mut fidl::encoding::Encoder<'_, D>,
171 offset: usize,
172 _depth: fidl::encoding::Depth,
173 ) -> fidl::Result<()> {
174 encoder.debug_check_bounds::<Self>(offset);
175 encoder.write_num(self.bits(), offset);
176 Ok(())
177 }
178 }
179
180 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InterruptOptions {
181 #[inline(always)]
182 fn new_empty() -> Self {
183 Self::empty()
184 }
185
186 #[inline]
187 unsafe fn decode(
188 &mut self,
189 decoder: &mut fidl::encoding::Decoder<'_, D>,
190 offset: usize,
191 _depth: fidl::encoding::Depth,
192 ) -> fidl::Result<()> {
193 decoder.debug_check_bounds::<Self>(offset);
194 let prim = decoder.read_num::<u32>(offset);
195 *self = Self::from_bits_allow_unknown(prim);
196 Ok(())
197 }
198 }
199 unsafe impl fidl::encoding::TypeMarker for BufferMode {
200 type Owned = Self;
201
202 #[inline(always)]
203 fn inline_align(_context: fidl::encoding::Context) -> usize {
204 std::mem::align_of::<u32>()
205 }
206
207 #[inline(always)]
208 fn inline_size(_context: fidl::encoding::Context) -> usize {
209 std::mem::size_of::<u32>()
210 }
211
212 #[inline(always)]
213 fn encode_is_copy() -> bool {
214 true
215 }
216
217 #[inline(always)]
218 fn decode_is_copy() -> bool {
219 false
220 }
221 }
222
223 impl fidl::encoding::ValueTypeMarker for BufferMode {
224 type Borrowed<'a> = Self;
225 #[inline(always)]
226 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
227 *value
228 }
229 }
230
231 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for BufferMode {
232 #[inline]
233 unsafe fn encode(
234 self,
235 encoder: &mut fidl::encoding::Encoder<'_, D>,
236 offset: usize,
237 _depth: fidl::encoding::Depth,
238 ) -> fidl::Result<()> {
239 encoder.debug_check_bounds::<Self>(offset);
240 encoder.write_num(self.into_primitive(), offset);
241 Ok(())
242 }
243 }
244
245 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BufferMode {
246 #[inline(always)]
247 fn new_empty() -> Self {
248 Self::Input
249 }
250
251 #[inline]
252 unsafe fn decode(
253 &mut self,
254 decoder: &mut fidl::encoding::Decoder<'_, D>,
255 offset: usize,
256 _depth: fidl::encoding::Depth,
257 ) -> fidl::Result<()> {
258 decoder.debug_check_bounds::<Self>(offset);
259 let prim = decoder.read_num::<u32>(offset);
260
261 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
262 Ok(())
263 }
264 }
265 unsafe impl fidl::encoding::TypeMarker for InterruptMode {
266 type Owned = Self;
267
268 #[inline(always)]
269 fn inline_align(_context: fidl::encoding::Context) -> usize {
270 std::mem::align_of::<u32>()
271 }
272
273 #[inline(always)]
274 fn inline_size(_context: fidl::encoding::Context) -> usize {
275 std::mem::size_of::<u32>()
276 }
277
278 #[inline(always)]
279 fn encode_is_copy() -> bool {
280 true
281 }
282
283 #[inline(always)]
284 fn decode_is_copy() -> bool {
285 false
286 }
287 }
288
289 impl fidl::encoding::ValueTypeMarker for InterruptMode {
290 type Borrowed<'a> = Self;
291 #[inline(always)]
292 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
293 *value
294 }
295 }
296
297 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for InterruptMode {
298 #[inline]
299 unsafe fn encode(
300 self,
301 encoder: &mut fidl::encoding::Encoder<'_, D>,
302 offset: usize,
303 _depth: fidl::encoding::Depth,
304 ) -> fidl::Result<()> {
305 encoder.debug_check_bounds::<Self>(offset);
306 encoder.write_num(self.into_primitive(), offset);
307 Ok(())
308 }
309 }
310
311 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InterruptMode {
312 #[inline(always)]
313 fn new_empty() -> Self {
314 Self::EdgeLow
315 }
316
317 #[inline]
318 unsafe fn decode(
319 &mut self,
320 decoder: &mut fidl::encoding::Decoder<'_, D>,
321 offset: usize,
322 _depth: fidl::encoding::Depth,
323 ) -> fidl::Result<()> {
324 decoder.debug_check_bounds::<Self>(offset);
325 let prim = decoder.read_num::<u32>(offset);
326
327 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
328 Ok(())
329 }
330 }
331
332 impl fidl::encoding::ValueTypeMarker for GpioConfigureInterruptRequest {
333 type Borrowed<'a> = &'a Self;
334 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
335 value
336 }
337 }
338
339 unsafe impl fidl::encoding::TypeMarker for GpioConfigureInterruptRequest {
340 type Owned = Self;
341
342 #[inline(always)]
343 fn inline_align(_context: fidl::encoding::Context) -> usize {
344 8
345 }
346
347 #[inline(always)]
348 fn inline_size(_context: fidl::encoding::Context) -> usize {
349 16
350 }
351 }
352
353 unsafe impl<D: fidl::encoding::ResourceDialect>
354 fidl::encoding::Encode<GpioConfigureInterruptRequest, D>
355 for &GpioConfigureInterruptRequest
356 {
357 #[inline]
358 unsafe fn encode(
359 self,
360 encoder: &mut fidl::encoding::Encoder<'_, D>,
361 offset: usize,
362 _depth: fidl::encoding::Depth,
363 ) -> fidl::Result<()> {
364 encoder.debug_check_bounds::<GpioConfigureInterruptRequest>(offset);
365 fidl::encoding::Encode::<GpioConfigureInterruptRequest, D>::encode(
367 (<InterruptConfiguration as fidl::encoding::ValueTypeMarker>::borrow(&self.config),),
368 encoder,
369 offset,
370 _depth,
371 )
372 }
373 }
374 unsafe impl<
375 D: fidl::encoding::ResourceDialect,
376 T0: fidl::encoding::Encode<InterruptConfiguration, D>,
377 > fidl::encoding::Encode<GpioConfigureInterruptRequest, D> for (T0,)
378 {
379 #[inline]
380 unsafe fn encode(
381 self,
382 encoder: &mut fidl::encoding::Encoder<'_, D>,
383 offset: usize,
384 depth: fidl::encoding::Depth,
385 ) -> fidl::Result<()> {
386 encoder.debug_check_bounds::<GpioConfigureInterruptRequest>(offset);
387 self.0.encode(encoder, offset + 0, depth)?;
391 Ok(())
392 }
393 }
394
395 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
396 for GpioConfigureInterruptRequest
397 {
398 #[inline(always)]
399 fn new_empty() -> Self {
400 Self { config: fidl::new_empty!(InterruptConfiguration, D) }
401 }
402
403 #[inline]
404 unsafe fn decode(
405 &mut self,
406 decoder: &mut fidl::encoding::Decoder<'_, D>,
407 offset: usize,
408 _depth: fidl::encoding::Depth,
409 ) -> fidl::Result<()> {
410 decoder.debug_check_bounds::<Self>(offset);
411 fidl::decode!(
413 InterruptConfiguration,
414 D,
415 &mut self.config,
416 decoder,
417 offset + 0,
418 _depth
419 )?;
420 Ok(())
421 }
422 }
423
424 impl fidl::encoding::ValueTypeMarker for GpioGetInterruptRequest {
425 type Borrowed<'a> = &'a Self;
426 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
427 value
428 }
429 }
430
431 unsafe impl fidl::encoding::TypeMarker for GpioGetInterruptRequest {
432 type Owned = Self;
433
434 #[inline(always)]
435 fn inline_align(_context: fidl::encoding::Context) -> usize {
436 4
437 }
438
439 #[inline(always)]
440 fn inline_size(_context: fidl::encoding::Context) -> usize {
441 4
442 }
443 }
444
445 unsafe impl<D: fidl::encoding::ResourceDialect>
446 fidl::encoding::Encode<GpioGetInterruptRequest, D> for &GpioGetInterruptRequest
447 {
448 #[inline]
449 unsafe fn encode(
450 self,
451 encoder: &mut fidl::encoding::Encoder<'_, D>,
452 offset: usize,
453 _depth: fidl::encoding::Depth,
454 ) -> fidl::Result<()> {
455 encoder.debug_check_bounds::<GpioGetInterruptRequest>(offset);
456 fidl::encoding::Encode::<GpioGetInterruptRequest, D>::encode(
458 (<InterruptOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),),
459 encoder,
460 offset,
461 _depth,
462 )
463 }
464 }
465 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<InterruptOptions, D>>
466 fidl::encoding::Encode<GpioGetInterruptRequest, D> for (T0,)
467 {
468 #[inline]
469 unsafe fn encode(
470 self,
471 encoder: &mut fidl::encoding::Encoder<'_, D>,
472 offset: usize,
473 depth: fidl::encoding::Depth,
474 ) -> fidl::Result<()> {
475 encoder.debug_check_bounds::<GpioGetInterruptRequest>(offset);
476 self.0.encode(encoder, offset + 0, depth)?;
480 Ok(())
481 }
482 }
483
484 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
485 for GpioGetInterruptRequest
486 {
487 #[inline(always)]
488 fn new_empty() -> Self {
489 Self { options: fidl::new_empty!(InterruptOptions, D) }
490 }
491
492 #[inline]
493 unsafe fn decode(
494 &mut self,
495 decoder: &mut fidl::encoding::Decoder<'_, D>,
496 offset: usize,
497 _depth: fidl::encoding::Depth,
498 ) -> fidl::Result<()> {
499 decoder.debug_check_bounds::<Self>(offset);
500 fidl::decode!(InterruptOptions, D, &mut self.options, decoder, offset + 0, _depth)?;
502 Ok(())
503 }
504 }
505
506 impl fidl::encoding::ValueTypeMarker for GpioSetBufferModeRequest {
507 type Borrowed<'a> = &'a Self;
508 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
509 value
510 }
511 }
512
513 unsafe impl fidl::encoding::TypeMarker for GpioSetBufferModeRequest {
514 type Owned = Self;
515
516 #[inline(always)]
517 fn inline_align(_context: fidl::encoding::Context) -> usize {
518 4
519 }
520
521 #[inline(always)]
522 fn inline_size(_context: fidl::encoding::Context) -> usize {
523 4
524 }
525 }
526
527 unsafe impl<D: fidl::encoding::ResourceDialect>
528 fidl::encoding::Encode<GpioSetBufferModeRequest, D> for &GpioSetBufferModeRequest
529 {
530 #[inline]
531 unsafe fn encode(
532 self,
533 encoder: &mut fidl::encoding::Encoder<'_, D>,
534 offset: usize,
535 _depth: fidl::encoding::Depth,
536 ) -> fidl::Result<()> {
537 encoder.debug_check_bounds::<GpioSetBufferModeRequest>(offset);
538 fidl::encoding::Encode::<GpioSetBufferModeRequest, D>::encode(
540 (<BufferMode as fidl::encoding::ValueTypeMarker>::borrow(&self.mode),),
541 encoder,
542 offset,
543 _depth,
544 )
545 }
546 }
547 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<BufferMode, D>>
548 fidl::encoding::Encode<GpioSetBufferModeRequest, D> for (T0,)
549 {
550 #[inline]
551 unsafe fn encode(
552 self,
553 encoder: &mut fidl::encoding::Encoder<'_, D>,
554 offset: usize,
555 depth: fidl::encoding::Depth,
556 ) -> fidl::Result<()> {
557 encoder.debug_check_bounds::<GpioSetBufferModeRequest>(offset);
558 self.0.encode(encoder, offset + 0, depth)?;
562 Ok(())
563 }
564 }
565
566 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
567 for GpioSetBufferModeRequest
568 {
569 #[inline(always)]
570 fn new_empty() -> Self {
571 Self { mode: fidl::new_empty!(BufferMode, D) }
572 }
573
574 #[inline]
575 unsafe fn decode(
576 &mut self,
577 decoder: &mut fidl::encoding::Decoder<'_, D>,
578 offset: usize,
579 _depth: fidl::encoding::Depth,
580 ) -> fidl::Result<()> {
581 decoder.debug_check_bounds::<Self>(offset);
582 fidl::decode!(BufferMode, D, &mut self.mode, decoder, offset + 0, _depth)?;
584 Ok(())
585 }
586 }
587
588 impl fidl::encoding::ValueTypeMarker for GpioReadResponse {
589 type Borrowed<'a> = &'a Self;
590 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
591 value
592 }
593 }
594
595 unsafe impl fidl::encoding::TypeMarker for GpioReadResponse {
596 type Owned = Self;
597
598 #[inline(always)]
599 fn inline_align(_context: fidl::encoding::Context) -> usize {
600 1
601 }
602
603 #[inline(always)]
604 fn inline_size(_context: fidl::encoding::Context) -> usize {
605 1
606 }
607 }
608
609 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<GpioReadResponse, D>
610 for &GpioReadResponse
611 {
612 #[inline]
613 unsafe fn encode(
614 self,
615 encoder: &mut fidl::encoding::Encoder<'_, D>,
616 offset: usize,
617 _depth: fidl::encoding::Depth,
618 ) -> fidl::Result<()> {
619 encoder.debug_check_bounds::<GpioReadResponse>(offset);
620 fidl::encoding::Encode::<GpioReadResponse, D>::encode(
622 (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.value),),
623 encoder,
624 offset,
625 _depth,
626 )
627 }
628 }
629 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
630 fidl::encoding::Encode<GpioReadResponse, D> for (T0,)
631 {
632 #[inline]
633 unsafe fn encode(
634 self,
635 encoder: &mut fidl::encoding::Encoder<'_, D>,
636 offset: usize,
637 depth: fidl::encoding::Depth,
638 ) -> fidl::Result<()> {
639 encoder.debug_check_bounds::<GpioReadResponse>(offset);
640 self.0.encode(encoder, offset + 0, depth)?;
644 Ok(())
645 }
646 }
647
648 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for GpioReadResponse {
649 #[inline(always)]
650 fn new_empty() -> Self {
651 Self { value: fidl::new_empty!(bool, D) }
652 }
653
654 #[inline]
655 unsafe fn decode(
656 &mut self,
657 decoder: &mut fidl::encoding::Decoder<'_, D>,
658 offset: usize,
659 _depth: fidl::encoding::Depth,
660 ) -> fidl::Result<()> {
661 decoder.debug_check_bounds::<Self>(offset);
662 fidl::decode!(bool, D, &mut self.value, decoder, offset + 0, _depth)?;
664 Ok(())
665 }
666 }
667
668 impl InterruptConfiguration {
669 #[inline(always)]
670 fn max_ordinal_present(&self) -> u64 {
671 if let Some(_) = self.mode {
672 return 1;
673 }
674 0
675 }
676 }
677
678 impl fidl::encoding::ValueTypeMarker for InterruptConfiguration {
679 type Borrowed<'a> = &'a Self;
680 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
681 value
682 }
683 }
684
685 unsafe impl fidl::encoding::TypeMarker for InterruptConfiguration {
686 type Owned = Self;
687
688 #[inline(always)]
689 fn inline_align(_context: fidl::encoding::Context) -> usize {
690 8
691 }
692
693 #[inline(always)]
694 fn inline_size(_context: fidl::encoding::Context) -> usize {
695 16
696 }
697 }
698
699 unsafe impl<D: fidl::encoding::ResourceDialect>
700 fidl::encoding::Encode<InterruptConfiguration, D> for &InterruptConfiguration
701 {
702 unsafe fn encode(
703 self,
704 encoder: &mut fidl::encoding::Encoder<'_, D>,
705 offset: usize,
706 mut depth: fidl::encoding::Depth,
707 ) -> fidl::Result<()> {
708 encoder.debug_check_bounds::<InterruptConfiguration>(offset);
709 let max_ordinal: u64 = self.max_ordinal_present();
711 encoder.write_num(max_ordinal, offset);
712 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
713 if max_ordinal == 0 {
715 return Ok(());
716 }
717 depth.increment()?;
718 let envelope_size = 8;
719 let bytes_len = max_ordinal as usize * envelope_size;
720 #[allow(unused_variables)]
721 let offset = encoder.out_of_line_offset(bytes_len);
722 let mut _prev_end_offset: usize = 0;
723 if 1 > max_ordinal {
724 return Ok(());
725 }
726
727 let cur_offset: usize = (1 - 1) * envelope_size;
730
731 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
733
734 fidl::encoding::encode_in_envelope_optional::<InterruptMode, D>(
739 self.mode.as_ref().map(<InterruptMode as fidl::encoding::ValueTypeMarker>::borrow),
740 encoder,
741 offset + cur_offset,
742 depth,
743 )?;
744
745 _prev_end_offset = cur_offset + envelope_size;
746
747 Ok(())
748 }
749 }
750
751 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
752 for InterruptConfiguration
753 {
754 #[inline(always)]
755 fn new_empty() -> Self {
756 Self::default()
757 }
758
759 unsafe fn decode(
760 &mut self,
761 decoder: &mut fidl::encoding::Decoder<'_, D>,
762 offset: usize,
763 mut depth: fidl::encoding::Depth,
764 ) -> fidl::Result<()> {
765 decoder.debug_check_bounds::<Self>(offset);
766 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
767 None => return Err(fidl::Error::NotNullable),
768 Some(len) => len,
769 };
770 if len == 0 {
772 return Ok(());
773 };
774 depth.increment()?;
775 let envelope_size = 8;
776 let bytes_len = len * envelope_size;
777 let offset = decoder.out_of_line_offset(bytes_len)?;
778 let mut _next_ordinal_to_read = 0;
780 let mut next_offset = offset;
781 let end_offset = offset + bytes_len;
782 _next_ordinal_to_read += 1;
783 if next_offset >= end_offset {
784 return Ok(());
785 }
786
787 while _next_ordinal_to_read < 1 {
789 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
790 _next_ordinal_to_read += 1;
791 next_offset += envelope_size;
792 }
793
794 let next_out_of_line = decoder.next_out_of_line();
795 let handles_before = decoder.remaining_handles();
796 if let Some((inlined, num_bytes, num_handles)) =
797 fidl::encoding::decode_envelope_header(decoder, next_offset)?
798 {
799 let member_inline_size =
800 <InterruptMode as fidl::encoding::TypeMarker>::inline_size(decoder.context);
801 if inlined != (member_inline_size <= 4) {
802 return Err(fidl::Error::InvalidInlineBitInEnvelope);
803 }
804 let inner_offset;
805 let mut inner_depth = depth.clone();
806 if inlined {
807 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
808 inner_offset = next_offset;
809 } else {
810 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
811 inner_depth.increment()?;
812 }
813 let val_ref = self.mode.get_or_insert_with(|| fidl::new_empty!(InterruptMode, D));
814 fidl::decode!(InterruptMode, D, val_ref, decoder, inner_offset, inner_depth)?;
815 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
816 {
817 return Err(fidl::Error::InvalidNumBytesInEnvelope);
818 }
819 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
820 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
821 }
822 }
823
824 next_offset += envelope_size;
825
826 while next_offset < end_offset {
828 _next_ordinal_to_read += 1;
829 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
830 next_offset += envelope_size;
831 }
832
833 Ok(())
834 }
835 }
836}