Skip to main content

fidl_next_common_fuchsia_hardware_gpio/
fidl_next_common_fuchsia_hardware_gpio.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    #[doc = " Whether to drive the GPIO to a high or low voltage, or disable the output buffer.\n"]
8    #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
9    #[repr(u32)]
10    pub enum BufferMode {
11        Input = 0,
12        OutputLow = 1,
13        OutputHigh = 2,
14    }
15    impl ::core::convert::TryFrom<u32> for BufferMode {
16        type Error = ::fidl_next::UnknownStrictEnumMemberError;
17        fn try_from(
18            value: u32,
19        ) -> ::core::result::Result<Self, ::fidl_next::UnknownStrictEnumMemberError> {
20            match value {
21                0 => Ok(Self::Input),
22                1 => Ok(Self::OutputLow),
23                2 => Ok(Self::OutputHigh),
24
25                _ => Err(::fidl_next::UnknownStrictEnumMemberError::new(value.into())),
26            }
27        }
28    }
29
30    impl ::std::convert::From<BufferMode> for u32 {
31        fn from(value: BufferMode) -> Self {
32            match value {
33                BufferMode::Input => 0,
34                BufferMode::OutputLow => 1,
35                BufferMode::OutputHigh => 2,
36            }
37        }
38    }
39
40    unsafe impl<___E> ::fidl_next::Encode<crate::wire::BufferMode, ___E> for BufferMode
41    where
42        ___E: ?Sized,
43    {
44        #[inline]
45        fn encode(
46            self,
47            encoder: &mut ___E,
48            out: &mut ::core::mem::MaybeUninit<crate::wire::BufferMode>,
49            _: (),
50        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
51            ::fidl_next::Encode::encode(&self, encoder, out, ())
52        }
53    }
54
55    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::BufferMode, ___E> for &'a BufferMode
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::BufferMode>,
64            _: (),
65        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
66            ::fidl_next::munge!(let crate::wire::BufferMode { value } = out);
67            let _ = value.write(::fidl_next::wire::Uint32::from(match *self {
68                BufferMode::Input => 0,
69
70                BufferMode::OutputLow => 1,
71
72                BufferMode::OutputHigh => 2,
73            }));
74
75            Ok(())
76        }
77    }
78
79    impl ::core::convert::From<crate::wire::BufferMode> for BufferMode {
80        fn from(wire: crate::wire::BufferMode) -> Self {
81            match u32::from(wire.value) {
82                0 => Self::Input,
83
84                1 => Self::OutputLow,
85
86                2 => Self::OutputHigh,
87
88                _ => unsafe { ::core::hint::unreachable_unchecked() },
89            }
90        }
91    }
92
93    impl ::fidl_next::FromWire<crate::wire::BufferMode> for BufferMode {
94        #[inline]
95        fn from_wire(wire: crate::wire::BufferMode) -> Self {
96            Self::from(wire)
97        }
98    }
99
100    impl ::fidl_next::FromWireRef<crate::wire::BufferMode> for BufferMode {
101        #[inline]
102        fn from_wire_ref(wire: &crate::wire::BufferMode) -> Self {
103            Self::from(*wire)
104        }
105    }
106
107    #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
108    #[repr(C)]
109    pub struct GpioReadResponse {
110        pub value: bool,
111    }
112
113    unsafe impl<___E> ::fidl_next::Encode<crate::wire::GpioReadResponse, ___E> for GpioReadResponse
114    where
115        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
116    {
117        const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
118            Self,
119            crate::wire::GpioReadResponse,
120        > = unsafe {
121            ::fidl_next::CopyOptimization::enable_if(
122                true && <bool as ::fidl_next::Encode<bool, ___E>>::COPY_OPTIMIZATION.is_enabled(),
123            )
124        };
125
126        #[inline]
127        fn encode(
128            self,
129            encoder_: &mut ___E,
130            out_: &mut ::core::mem::MaybeUninit<crate::wire::GpioReadResponse>,
131            _: (),
132        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
133            ::fidl_next::munge! {
134                let crate::wire::GpioReadResponse {
135                    value,
136
137                } = out_;
138            }
139
140            ::fidl_next::Encode::encode(self.value, encoder_, value, ())?;
141
142            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(value.as_mut_ptr()) };
143
144            Ok(())
145        }
146    }
147
148    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::GpioReadResponse, ___E>
149        for &'a GpioReadResponse
150    where
151        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
152    {
153        #[inline]
154        fn encode(
155            self,
156            encoder_: &mut ___E,
157            out_: &mut ::core::mem::MaybeUninit<crate::wire::GpioReadResponse>,
158            _: (),
159        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
160            ::fidl_next::munge! {
161                let crate::wire::GpioReadResponse {
162                    value,
163
164                } = out_;
165            }
166
167            ::fidl_next::Encode::encode(&self.value, encoder_, value, ())?;
168
169            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(value.as_mut_ptr()) };
170
171            Ok(())
172        }
173    }
174
175    unsafe impl<___E>
176        ::fidl_next::EncodeOption<
177            ::fidl_next::wire::Box<'static, crate::wire::GpioReadResponse>,
178            ___E,
179        > for GpioReadResponse
180    where
181        ___E: ::fidl_next::Encoder + ?Sized,
182        GpioReadResponse: ::fidl_next::Encode<crate::wire::GpioReadResponse, ___E>,
183    {
184        #[inline]
185        fn encode_option(
186            this: ::core::option::Option<Self>,
187            encoder: &mut ___E,
188            out: &mut ::core::mem::MaybeUninit<
189                ::fidl_next::wire::Box<'static, crate::wire::GpioReadResponse>,
190            >,
191            _: (),
192        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
193            if let Some(inner) = this {
194                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
195                ::fidl_next::wire::Box::encode_present(out);
196            } else {
197                ::fidl_next::wire::Box::encode_absent(out);
198            }
199
200            Ok(())
201        }
202    }
203
204    unsafe impl<'a, ___E>
205        ::fidl_next::EncodeOption<
206            ::fidl_next::wire::Box<'static, crate::wire::GpioReadResponse>,
207            ___E,
208        > for &'a GpioReadResponse
209    where
210        ___E: ::fidl_next::Encoder + ?Sized,
211        &'a GpioReadResponse: ::fidl_next::Encode<crate::wire::GpioReadResponse, ___E>,
212    {
213        #[inline]
214        fn encode_option(
215            this: ::core::option::Option<Self>,
216            encoder: &mut ___E,
217            out: &mut ::core::mem::MaybeUninit<
218                ::fidl_next::wire::Box<'static, crate::wire::GpioReadResponse>,
219            >,
220            _: (),
221        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
222            if let Some(inner) = this {
223                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
224                ::fidl_next::wire::Box::encode_present(out);
225            } else {
226                ::fidl_next::wire::Box::encode_absent(out);
227            }
228
229            Ok(())
230        }
231    }
232
233    impl ::fidl_next::FromWire<crate::wire::GpioReadResponse> for GpioReadResponse {
234        const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
235            crate::wire::GpioReadResponse,
236            Self,
237        > = unsafe {
238            ::fidl_next::CopyOptimization::enable_if(
239                true && <bool as ::fidl_next::FromWire<bool>>::COPY_OPTIMIZATION.is_enabled(),
240            )
241        };
242
243        #[inline]
244        fn from_wire(wire: crate::wire::GpioReadResponse) -> Self {
245            Self { value: ::fidl_next::FromWire::from_wire(wire.value) }
246        }
247    }
248
249    impl ::fidl_next::FromWireRef<crate::wire::GpioReadResponse> for GpioReadResponse {
250        #[inline]
251        fn from_wire_ref(wire: &crate::wire::GpioReadResponse) -> Self {
252            Self { value: ::fidl_next::FromWireRef::from_wire_ref(&wire.value) }
253        }
254    }
255
256    #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
257    #[repr(C)]
258    pub struct GpioSetBufferModeRequest {
259        pub mode: crate::natural::BufferMode,
260    }
261
262    unsafe impl<___E> ::fidl_next::Encode<crate::wire::GpioSetBufferModeRequest, ___E>
263        for GpioSetBufferModeRequest
264    where
265        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
266    {
267        const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
268            Self,
269            crate::wire::GpioSetBufferModeRequest,
270        > = unsafe {
271            ::fidl_next::CopyOptimization::enable_if(
272                true && <crate::natural::BufferMode as ::fidl_next::Encode<
273                    crate::wire::BufferMode,
274                    ___E,
275                >>::COPY_OPTIMIZATION
276                    .is_enabled(),
277            )
278        };
279
280        #[inline]
281        fn encode(
282            self,
283            encoder_: &mut ___E,
284            out_: &mut ::core::mem::MaybeUninit<crate::wire::GpioSetBufferModeRequest>,
285            _: (),
286        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
287            ::fidl_next::munge! {
288                let crate::wire::GpioSetBufferModeRequest {
289                    mode,
290
291                } = out_;
292            }
293
294            ::fidl_next::Encode::encode(self.mode, encoder_, mode, ())?;
295
296            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(mode.as_mut_ptr()) };
297
298            Ok(())
299        }
300    }
301
302    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::GpioSetBufferModeRequest, ___E>
303        for &'a GpioSetBufferModeRequest
304    where
305        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
306    {
307        #[inline]
308        fn encode(
309            self,
310            encoder_: &mut ___E,
311            out_: &mut ::core::mem::MaybeUninit<crate::wire::GpioSetBufferModeRequest>,
312            _: (),
313        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
314            ::fidl_next::munge! {
315                let crate::wire::GpioSetBufferModeRequest {
316                    mode,
317
318                } = out_;
319            }
320
321            ::fidl_next::Encode::encode(&self.mode, encoder_, mode, ())?;
322
323            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(mode.as_mut_ptr()) };
324
325            Ok(())
326        }
327    }
328
329    unsafe impl<___E>
330        ::fidl_next::EncodeOption<
331            ::fidl_next::wire::Box<'static, crate::wire::GpioSetBufferModeRequest>,
332            ___E,
333        > for GpioSetBufferModeRequest
334    where
335        ___E: ::fidl_next::Encoder + ?Sized,
336        GpioSetBufferModeRequest: ::fidl_next::Encode<crate::wire::GpioSetBufferModeRequest, ___E>,
337    {
338        #[inline]
339        fn encode_option(
340            this: ::core::option::Option<Self>,
341            encoder: &mut ___E,
342            out: &mut ::core::mem::MaybeUninit<
343                ::fidl_next::wire::Box<'static, crate::wire::GpioSetBufferModeRequest>,
344            >,
345            _: (),
346        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
347            if let Some(inner) = this {
348                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
349                ::fidl_next::wire::Box::encode_present(out);
350            } else {
351                ::fidl_next::wire::Box::encode_absent(out);
352            }
353
354            Ok(())
355        }
356    }
357
358    unsafe impl<'a, ___E>
359        ::fidl_next::EncodeOption<
360            ::fidl_next::wire::Box<'static, crate::wire::GpioSetBufferModeRequest>,
361            ___E,
362        > for &'a GpioSetBufferModeRequest
363    where
364        ___E: ::fidl_next::Encoder + ?Sized,
365        &'a GpioSetBufferModeRequest:
366            ::fidl_next::Encode<crate::wire::GpioSetBufferModeRequest, ___E>,
367    {
368        #[inline]
369        fn encode_option(
370            this: ::core::option::Option<Self>,
371            encoder: &mut ___E,
372            out: &mut ::core::mem::MaybeUninit<
373                ::fidl_next::wire::Box<'static, crate::wire::GpioSetBufferModeRequest>,
374            >,
375            _: (),
376        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
377            if let Some(inner) = this {
378                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
379                ::fidl_next::wire::Box::encode_present(out);
380            } else {
381                ::fidl_next::wire::Box::encode_absent(out);
382            }
383
384            Ok(())
385        }
386    }
387
388    impl ::fidl_next::FromWire<crate::wire::GpioSetBufferModeRequest> for GpioSetBufferModeRequest {
389        const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
390            crate::wire::GpioSetBufferModeRequest,
391            Self,
392        > = unsafe {
393            ::fidl_next::CopyOptimization::enable_if(
394                true && <crate::natural::BufferMode as ::fidl_next::FromWire<
395                    crate::wire::BufferMode,
396                >>::COPY_OPTIMIZATION
397                    .is_enabled(),
398            )
399        };
400
401        #[inline]
402        fn from_wire(wire: crate::wire::GpioSetBufferModeRequest) -> Self {
403            Self { mode: ::fidl_next::FromWire::from_wire(wire.mode) }
404        }
405    }
406
407    impl ::fidl_next::FromWireRef<crate::wire::GpioSetBufferModeRequest> for GpioSetBufferModeRequest {
408        #[inline]
409        fn from_wire_ref(wire: &crate::wire::GpioSetBufferModeRequest) -> Self {
410            Self { mode: ::fidl_next::FromWireRef::from_wire_ref(&wire.mode) }
411        }
412    }
413
414    pub type GpioSetBufferModeResponse = ();
415
416    #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
417    #[repr(u32)]
418    pub enum InterruptMode {
419        EdgeLow = 0,
420        EdgeHigh = 1,
421        EdgeBoth = 2,
422        LevelLow = 3,
423        LevelHigh = 4,
424    }
425    impl ::core::convert::TryFrom<u32> for InterruptMode {
426        type Error = ::fidl_next::UnknownStrictEnumMemberError;
427        fn try_from(
428            value: u32,
429        ) -> ::core::result::Result<Self, ::fidl_next::UnknownStrictEnumMemberError> {
430            match value {
431                0 => Ok(Self::EdgeLow),
432                1 => Ok(Self::EdgeHigh),
433                2 => Ok(Self::EdgeBoth),
434                3 => Ok(Self::LevelLow),
435                4 => Ok(Self::LevelHigh),
436
437                _ => Err(::fidl_next::UnknownStrictEnumMemberError::new(value.into())),
438            }
439        }
440    }
441
442    impl ::std::convert::From<InterruptMode> for u32 {
443        fn from(value: InterruptMode) -> Self {
444            match value {
445                InterruptMode::EdgeLow => 0,
446                InterruptMode::EdgeHigh => 1,
447                InterruptMode::EdgeBoth => 2,
448                InterruptMode::LevelLow => 3,
449                InterruptMode::LevelHigh => 4,
450            }
451        }
452    }
453
454    unsafe impl<___E> ::fidl_next::Encode<crate::wire::InterruptMode, ___E> for InterruptMode
455    where
456        ___E: ?Sized,
457    {
458        #[inline]
459        fn encode(
460            self,
461            encoder: &mut ___E,
462            out: &mut ::core::mem::MaybeUninit<crate::wire::InterruptMode>,
463            _: (),
464        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
465            ::fidl_next::Encode::encode(&self, encoder, out, ())
466        }
467    }
468
469    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::InterruptMode, ___E> for &'a InterruptMode
470    where
471        ___E: ?Sized,
472    {
473        #[inline]
474        fn encode(
475            self,
476            encoder: &mut ___E,
477            out: &mut ::core::mem::MaybeUninit<crate::wire::InterruptMode>,
478            _: (),
479        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
480            ::fidl_next::munge!(let crate::wire::InterruptMode { value } = out);
481            let _ = value.write(::fidl_next::wire::Uint32::from(match *self {
482                InterruptMode::EdgeLow => 0,
483
484                InterruptMode::EdgeHigh => 1,
485
486                InterruptMode::EdgeBoth => 2,
487
488                InterruptMode::LevelLow => 3,
489
490                InterruptMode::LevelHigh => 4,
491            }));
492
493            Ok(())
494        }
495    }
496
497    impl ::core::convert::From<crate::wire::InterruptMode> for InterruptMode {
498        fn from(wire: crate::wire::InterruptMode) -> Self {
499            match u32::from(wire.value) {
500                0 => Self::EdgeLow,
501
502                1 => Self::EdgeHigh,
503
504                2 => Self::EdgeBoth,
505
506                3 => Self::LevelLow,
507
508                4 => Self::LevelHigh,
509
510                _ => unsafe { ::core::hint::unreachable_unchecked() },
511            }
512        }
513    }
514
515    impl ::fidl_next::FromWire<crate::wire::InterruptMode> for InterruptMode {
516        #[inline]
517        fn from_wire(wire: crate::wire::InterruptMode) -> Self {
518            Self::from(wire)
519        }
520    }
521
522    impl ::fidl_next::FromWireRef<crate::wire::InterruptMode> for InterruptMode {
523        #[inline]
524        fn from_wire_ref(wire: &crate::wire::InterruptMode) -> Self {
525            Self::from(*wire)
526        }
527    }
528
529    #[derive(Debug, Default, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
530    pub struct InterruptConfiguration {
531        pub mode: ::core::option::Option<crate::natural::InterruptMode>,
532    }
533
534    impl InterruptConfiguration {
535        fn __max_ordinal(&self) -> usize {
536            if self.mode.is_some() {
537                return 1;
538            }
539
540            0
541        }
542    }
543
544    unsafe impl<___E> ::fidl_next::Encode<crate::wire::InterruptConfiguration<'static>, ___E>
545        for InterruptConfiguration
546    where
547        ___E: ::fidl_next::Encoder + ?Sized,
548    {
549        #[inline]
550        fn encode(
551            mut self,
552            encoder: &mut ___E,
553            out: &mut ::core::mem::MaybeUninit<crate::wire::InterruptConfiguration<'static>>,
554            _: (),
555        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
556            ::fidl_next::munge!(let crate::wire::InterruptConfiguration { table } = out);
557
558            let max_ord = self.__max_ordinal();
559
560            let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
561            ::fidl_next::Wire::zero_padding(&mut out);
562
563            let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
564                ::fidl_next::wire::Envelope,
565            >(encoder, max_ord);
566
567            for i in 1..=max_ord {
568                match i {
569                    1 => {
570                        if let Some(value) = self.mode.take() {
571                            ::fidl_next::wire::Envelope::encode_value::<
572                                crate::wire::InterruptMode,
573                                ___E,
574                            >(
575                                value, preallocated.encoder, &mut out, ()
576                            )?;
577                        } else {
578                            ::fidl_next::wire::Envelope::encode_zero(&mut out)
579                        }
580                    }
581
582                    _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
583                }
584                unsafe {
585                    preallocated.write_next(out.assume_init_ref());
586                }
587            }
588
589            ::fidl_next::wire::Table::encode_len(table, max_ord);
590
591            Ok(())
592        }
593    }
594
595    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::InterruptConfiguration<'static>, ___E>
596        for &'a InterruptConfiguration
597    where
598        ___E: ::fidl_next::Encoder + ?Sized,
599    {
600        #[inline]
601        fn encode(
602            self,
603            encoder: &mut ___E,
604            out: &mut ::core::mem::MaybeUninit<crate::wire::InterruptConfiguration<'static>>,
605            _: (),
606        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
607            ::fidl_next::munge!(let crate::wire::InterruptConfiguration { table } = out);
608
609            let max_ord = self.__max_ordinal();
610
611            let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
612            ::fidl_next::Wire::zero_padding(&mut out);
613
614            let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
615                ::fidl_next::wire::Envelope,
616            >(encoder, max_ord);
617
618            for i in 1..=max_ord {
619                match i {
620                    1 => {
621                        if let Some(value) = &self.mode {
622                            ::fidl_next::wire::Envelope::encode_value::<
623                                crate::wire::InterruptMode,
624                                ___E,
625                            >(
626                                value, preallocated.encoder, &mut out, ()
627                            )?;
628                        } else {
629                            ::fidl_next::wire::Envelope::encode_zero(&mut out)
630                        }
631                    }
632
633                    _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
634                }
635                unsafe {
636                    preallocated.write_next(out.assume_init_ref());
637                }
638            }
639
640            ::fidl_next::wire::Table::encode_len(table, max_ord);
641
642            Ok(())
643        }
644    }
645
646    impl<'de> ::fidl_next::FromWire<crate::wire::InterruptConfiguration<'de>>
647        for InterruptConfiguration
648    {
649        #[inline]
650        fn from_wire(wire_: crate::wire::InterruptConfiguration<'de>) -> Self {
651            let wire_ = ::core::mem::ManuallyDrop::new(wire_);
652
653            let mode = wire_.table.get(1);
654
655            Self {
656                mode: mode.map(|envelope| {
657                    ::fidl_next::FromWire::from_wire(unsafe {
658                        envelope.read_unchecked::<crate::wire::InterruptMode>()
659                    })
660                }),
661            }
662        }
663    }
664
665    impl<'de> ::fidl_next::FromWireRef<crate::wire::InterruptConfiguration<'de>>
666        for InterruptConfiguration
667    {
668        #[inline]
669        fn from_wire_ref(wire: &crate::wire::InterruptConfiguration<'de>) -> Self {
670            Self {
671                mode: wire.table.get(1).map(|envelope| {
672                    ::fidl_next::FromWireRef::from_wire_ref(unsafe {
673                        envelope.deref_unchecked::<crate::wire::InterruptMode>()
674                    })
675                }),
676            }
677        }
678    }
679
680    #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
681    pub struct GpioConfigureInterruptRequest {
682        pub config: crate::natural::InterruptConfiguration,
683    }
684
685    unsafe impl<___E> ::fidl_next::Encode<crate::wire::GpioConfigureInterruptRequest<'static>, ___E>
686        for GpioConfigureInterruptRequest
687    where
688        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
689        ___E: ::fidl_next::Encoder,
690    {
691        #[inline]
692        fn encode(
693            self,
694            encoder_: &mut ___E,
695            out_: &mut ::core::mem::MaybeUninit<
696                crate::wire::GpioConfigureInterruptRequest<'static>,
697            >,
698            _: (),
699        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
700            ::fidl_next::munge! {
701                let crate::wire::GpioConfigureInterruptRequest {
702                    config,
703
704                } = out_;
705            }
706
707            ::fidl_next::Encode::encode(self.config, encoder_, config, ())?;
708
709            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(config.as_mut_ptr()) };
710
711            Ok(())
712        }
713    }
714
715    unsafe impl<'a, ___E>
716        ::fidl_next::Encode<crate::wire::GpioConfigureInterruptRequest<'static>, ___E>
717        for &'a GpioConfigureInterruptRequest
718    where
719        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
720        ___E: ::fidl_next::Encoder,
721    {
722        #[inline]
723        fn encode(
724            self,
725            encoder_: &mut ___E,
726            out_: &mut ::core::mem::MaybeUninit<
727                crate::wire::GpioConfigureInterruptRequest<'static>,
728            >,
729            _: (),
730        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
731            ::fidl_next::munge! {
732                let crate::wire::GpioConfigureInterruptRequest {
733                    config,
734
735                } = out_;
736            }
737
738            ::fidl_next::Encode::encode(&self.config, encoder_, config, ())?;
739
740            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(config.as_mut_ptr()) };
741
742            Ok(())
743        }
744    }
745
746    unsafe impl<___E>
747        ::fidl_next::EncodeOption<
748            ::fidl_next::wire::Box<'static, crate::wire::GpioConfigureInterruptRequest<'static>>,
749            ___E,
750        > for GpioConfigureInterruptRequest
751    where
752        ___E: ::fidl_next::Encoder + ?Sized,
753        GpioConfigureInterruptRequest:
754            ::fidl_next::Encode<crate::wire::GpioConfigureInterruptRequest<'static>, ___E>,
755    {
756        #[inline]
757        fn encode_option(
758            this: ::core::option::Option<Self>,
759            encoder: &mut ___E,
760            out: &mut ::core::mem::MaybeUninit<
761                ::fidl_next::wire::Box<
762                    'static,
763                    crate::wire::GpioConfigureInterruptRequest<'static>,
764                >,
765            >,
766            _: (),
767        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
768            if let Some(inner) = this {
769                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
770                ::fidl_next::wire::Box::encode_present(out);
771            } else {
772                ::fidl_next::wire::Box::encode_absent(out);
773            }
774
775            Ok(())
776        }
777    }
778
779    unsafe impl<'a, ___E>
780        ::fidl_next::EncodeOption<
781            ::fidl_next::wire::Box<'static, crate::wire::GpioConfigureInterruptRequest<'static>>,
782            ___E,
783        > for &'a GpioConfigureInterruptRequest
784    where
785        ___E: ::fidl_next::Encoder + ?Sized,
786        &'a GpioConfigureInterruptRequest:
787            ::fidl_next::Encode<crate::wire::GpioConfigureInterruptRequest<'static>, ___E>,
788    {
789        #[inline]
790        fn encode_option(
791            this: ::core::option::Option<Self>,
792            encoder: &mut ___E,
793            out: &mut ::core::mem::MaybeUninit<
794                ::fidl_next::wire::Box<
795                    'static,
796                    crate::wire::GpioConfigureInterruptRequest<'static>,
797                >,
798            >,
799            _: (),
800        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
801            if let Some(inner) = this {
802                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
803                ::fidl_next::wire::Box::encode_present(out);
804            } else {
805                ::fidl_next::wire::Box::encode_absent(out);
806            }
807
808            Ok(())
809        }
810    }
811
812    impl<'de> ::fidl_next::FromWire<crate::wire::GpioConfigureInterruptRequest<'de>>
813        for GpioConfigureInterruptRequest
814    {
815        #[inline]
816        fn from_wire(wire: crate::wire::GpioConfigureInterruptRequest<'de>) -> Self {
817            Self { config: ::fidl_next::FromWire::from_wire(wire.config) }
818        }
819    }
820
821    impl<'de> ::fidl_next::FromWireRef<crate::wire::GpioConfigureInterruptRequest<'de>>
822        for GpioConfigureInterruptRequest
823    {
824        #[inline]
825        fn from_wire_ref(wire: &crate::wire::GpioConfigureInterruptRequest<'de>) -> Self {
826            Self { config: ::fidl_next::FromWireRef::from_wire_ref(&wire.config) }
827        }
828    }
829
830    pub type GpioConfigureInterruptResponse = ();
831
832    pub type GpioReleaseInterruptResponse = ();
833
834    ::fidl_next::bitflags::bitflags! {
835        #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, )]pub struct InterruptOptions: u32 {
836            #[doc = " The interrupt wakes up the system if the system is suspended.\n Must not be set if system suspend / resume is disabled.\n"]const WAKEABLE = 1;
837            #[doc = " The interrupt returns a monotonic timestamp from synchronous and\n asynchronous waits. Otherwise, it returns a boot timestamp from waits.\n"]const TIMESTAMP_MONO = 2;
838            const _ = !0;
839        }
840    }
841
842    unsafe impl<___E> ::fidl_next::Encode<crate::wire::InterruptOptions, ___E> for InterruptOptions
843    where
844        ___E: ?Sized,
845    {
846        #[inline]
847        fn encode(
848            self,
849            encoder: &mut ___E,
850            out: &mut ::core::mem::MaybeUninit<crate::wire::InterruptOptions>,
851            _: (),
852        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
853            ::fidl_next::Encode::encode(&self, encoder, out, ())
854        }
855    }
856
857    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::InterruptOptions, ___E>
858        for &'a InterruptOptions
859    where
860        ___E: ?Sized,
861    {
862        #[inline]
863        fn encode(
864            self,
865            _: &mut ___E,
866            out: &mut ::core::mem::MaybeUninit<crate::wire::InterruptOptions>,
867            _: (),
868        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
869            ::fidl_next::munge!(let crate::wire::InterruptOptions { value } = out);
870
871            let _ = value.write(::fidl_next::wire::Uint32::from(self.bits()));
872            Ok(())
873        }
874    }
875
876    impl ::core::convert::From<crate::wire::InterruptOptions> for InterruptOptions {
877        fn from(wire: crate::wire::InterruptOptions) -> Self {
878            Self::from_bits_retain(u32::from(wire.value))
879        }
880    }
881
882    impl ::fidl_next::FromWire<crate::wire::InterruptOptions> for InterruptOptions {
883        #[inline]
884        fn from_wire(wire: crate::wire::InterruptOptions) -> Self {
885            Self::from(wire)
886        }
887    }
888
889    impl ::fidl_next::FromWireRef<crate::wire::InterruptOptions> for InterruptOptions {
890        #[inline]
891        fn from_wire_ref(wire: &crate::wire::InterruptOptions) -> Self {
892            Self::from(*wire)
893        }
894    }
895
896    #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
897    #[repr(C)]
898    pub struct GpioGetInterruptRequest {
899        pub options: crate::natural::InterruptOptions,
900    }
901
902    unsafe impl<___E> ::fidl_next::Encode<crate::wire::GpioGetInterruptRequest, ___E>
903        for GpioGetInterruptRequest
904    where
905        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
906    {
907        const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
908            Self,
909            crate::wire::GpioGetInterruptRequest,
910        > = unsafe {
911            ::fidl_next::CopyOptimization::enable_if(
912                true && <crate::natural::InterruptOptions as ::fidl_next::Encode<
913                    crate::wire::InterruptOptions,
914                    ___E,
915                >>::COPY_OPTIMIZATION
916                    .is_enabled(),
917            )
918        };
919
920        #[inline]
921        fn encode(
922            self,
923            encoder_: &mut ___E,
924            out_: &mut ::core::mem::MaybeUninit<crate::wire::GpioGetInterruptRequest>,
925            _: (),
926        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
927            ::fidl_next::munge! {
928                let crate::wire::GpioGetInterruptRequest {
929                    options,
930
931                } = out_;
932            }
933
934            ::fidl_next::Encode::encode(self.options, encoder_, options, ())?;
935
936            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(options.as_mut_ptr()) };
937
938            Ok(())
939        }
940    }
941
942    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::GpioGetInterruptRequest, ___E>
943        for &'a GpioGetInterruptRequest
944    where
945        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
946    {
947        #[inline]
948        fn encode(
949            self,
950            encoder_: &mut ___E,
951            out_: &mut ::core::mem::MaybeUninit<crate::wire::GpioGetInterruptRequest>,
952            _: (),
953        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
954            ::fidl_next::munge! {
955                let crate::wire::GpioGetInterruptRequest {
956                    options,
957
958                } = out_;
959            }
960
961            ::fidl_next::Encode::encode(&self.options, encoder_, options, ())?;
962
963            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(options.as_mut_ptr()) };
964
965            Ok(())
966        }
967    }
968
969    unsafe impl<___E>
970        ::fidl_next::EncodeOption<
971            ::fidl_next::wire::Box<'static, crate::wire::GpioGetInterruptRequest>,
972            ___E,
973        > for GpioGetInterruptRequest
974    where
975        ___E: ::fidl_next::Encoder + ?Sized,
976        GpioGetInterruptRequest: ::fidl_next::Encode<crate::wire::GpioGetInterruptRequest, ___E>,
977    {
978        #[inline]
979        fn encode_option(
980            this: ::core::option::Option<Self>,
981            encoder: &mut ___E,
982            out: &mut ::core::mem::MaybeUninit<
983                ::fidl_next::wire::Box<'static, crate::wire::GpioGetInterruptRequest>,
984            >,
985            _: (),
986        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
987            if let Some(inner) = this {
988                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
989                ::fidl_next::wire::Box::encode_present(out);
990            } else {
991                ::fidl_next::wire::Box::encode_absent(out);
992            }
993
994            Ok(())
995        }
996    }
997
998    unsafe impl<'a, ___E>
999        ::fidl_next::EncodeOption<
1000            ::fidl_next::wire::Box<'static, crate::wire::GpioGetInterruptRequest>,
1001            ___E,
1002        > for &'a GpioGetInterruptRequest
1003    where
1004        ___E: ::fidl_next::Encoder + ?Sized,
1005        &'a GpioGetInterruptRequest:
1006            ::fidl_next::Encode<crate::wire::GpioGetInterruptRequest, ___E>,
1007    {
1008        #[inline]
1009        fn encode_option(
1010            this: ::core::option::Option<Self>,
1011            encoder: &mut ___E,
1012            out: &mut ::core::mem::MaybeUninit<
1013                ::fidl_next::wire::Box<'static, crate::wire::GpioGetInterruptRequest>,
1014            >,
1015            _: (),
1016        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1017            if let Some(inner) = this {
1018                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1019                ::fidl_next::wire::Box::encode_present(out);
1020            } else {
1021                ::fidl_next::wire::Box::encode_absent(out);
1022            }
1023
1024            Ok(())
1025        }
1026    }
1027
1028    impl ::fidl_next::FromWire<crate::wire::GpioGetInterruptRequest> for GpioGetInterruptRequest {
1029        const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
1030            crate::wire::GpioGetInterruptRequest,
1031            Self,
1032        > = unsafe {
1033            ::fidl_next::CopyOptimization::enable_if(
1034                true && <crate::natural::InterruptOptions as ::fidl_next::FromWire<
1035                    crate::wire::InterruptOptions,
1036                >>::COPY_OPTIMIZATION
1037                    .is_enabled(),
1038            )
1039        };
1040
1041        #[inline]
1042        fn from_wire(wire: crate::wire::GpioGetInterruptRequest) -> Self {
1043            Self { options: ::fidl_next::FromWire::from_wire(wire.options) }
1044        }
1045    }
1046
1047    impl ::fidl_next::FromWireRef<crate::wire::GpioGetInterruptRequest> for GpioGetInterruptRequest {
1048        #[inline]
1049        fn from_wire_ref(wire: &crate::wire::GpioGetInterruptRequest) -> Self {
1050            Self { options: ::fidl_next::FromWireRef::from_wire_ref(&wire.options) }
1051        }
1052    }
1053}
1054
1055pub mod wire {
1056
1057    /// The wire type corresponding to [`BufferMode`].
1058    #[derive(Clone, Copy, Debug, PartialEq, Eq)]
1059    #[repr(transparent)]
1060    pub struct BufferMode {
1061        pub(crate) value: ::fidl_next::wire::Uint32,
1062    }
1063
1064    impl ::fidl_next::Constrained for BufferMode {
1065        type Constraint = ();
1066
1067        fn validate(
1068            _: ::fidl_next::Slot<'_, Self>,
1069            _: Self::Constraint,
1070        ) -> Result<(), ::fidl_next::ValidationError> {
1071            Ok(())
1072        }
1073    }
1074
1075    unsafe impl ::fidl_next::Wire for BufferMode {
1076        type Narrowed<'de> = Self;
1077
1078        #[inline]
1079        fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
1080            // Wire enums have no padding
1081        }
1082    }
1083
1084    impl BufferMode {
1085        pub const INPUT: BufferMode = BufferMode { value: ::fidl_next::wire::Uint32(0) };
1086
1087        pub const OUTPUT_LOW: BufferMode = BufferMode { value: ::fidl_next::wire::Uint32(1) };
1088
1089        pub const OUTPUT_HIGH: BufferMode = BufferMode { value: ::fidl_next::wire::Uint32(2) };
1090    }
1091
1092    unsafe impl<___D> ::fidl_next::Decode<___D> for BufferMode
1093    where
1094        ___D: ?Sized,
1095    {
1096        fn decode(
1097            slot: ::fidl_next::Slot<'_, Self>,
1098            _: &mut ___D,
1099            _: (),
1100        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1101            ::fidl_next::munge!(let Self { value } = slot);
1102
1103            match u32::from(*value) {
1104                0 | 1 | 2 => (),
1105                unknown => {
1106                    return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128));
1107                }
1108            }
1109
1110            Ok(())
1111        }
1112    }
1113
1114    impl ::core::convert::From<crate::natural::BufferMode> for BufferMode {
1115        fn from(natural: crate::natural::BufferMode) -> Self {
1116            match natural {
1117                crate::natural::BufferMode::Input => BufferMode::INPUT,
1118
1119                crate::natural::BufferMode::OutputLow => BufferMode::OUTPUT_LOW,
1120
1121                crate::natural::BufferMode::OutputHigh => BufferMode::OUTPUT_HIGH,
1122            }
1123        }
1124    }
1125
1126    impl ::fidl_next::IntoNatural for BufferMode {
1127        type Natural = crate::natural::BufferMode;
1128    }
1129
1130    /// The wire type corresponding to [`GpioReadResponse`].
1131    #[derive(Clone, Debug)]
1132    #[repr(C)]
1133    pub struct GpioReadResponse {
1134        pub value: bool,
1135    }
1136
1137    static_assertions::const_assert_eq!(std::mem::size_of::<GpioReadResponse>(), 1);
1138    static_assertions::const_assert_eq!(std::mem::align_of::<GpioReadResponse>(), 1);
1139
1140    static_assertions::const_assert_eq!(std::mem::offset_of!(GpioReadResponse, value), 0);
1141
1142    impl ::fidl_next::Constrained for GpioReadResponse {
1143        type Constraint = ();
1144
1145        fn validate(
1146            _: ::fidl_next::Slot<'_, Self>,
1147            _: Self::Constraint,
1148        ) -> Result<(), ::fidl_next::ValidationError> {
1149            Ok(())
1150        }
1151    }
1152
1153    unsafe impl ::fidl_next::Wire for GpioReadResponse {
1154        type Narrowed<'de> = GpioReadResponse;
1155
1156        #[inline]
1157        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1158            ::fidl_next::munge! {
1159                let Self {
1160                    value,
1161
1162                } = &mut *out_;
1163            }
1164
1165            ::fidl_next::Wire::zero_padding(value);
1166        }
1167    }
1168
1169    unsafe impl<___D> ::fidl_next::Decode<___D> for GpioReadResponse
1170    where
1171        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1172    {
1173        fn decode(
1174            slot_: ::fidl_next::Slot<'_, Self>,
1175            decoder_: &mut ___D,
1176            _: (),
1177        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1178            ::fidl_next::munge! {
1179                let Self {
1180                    mut value,
1181
1182                } = slot_;
1183            }
1184
1185            let _field = value.as_mut();
1186
1187            ::fidl_next::Decode::decode(value.as_mut(), decoder_, ())?;
1188
1189            Ok(())
1190        }
1191    }
1192
1193    impl ::fidl_next::IntoNatural for GpioReadResponse {
1194        type Natural = crate::natural::GpioReadResponse;
1195    }
1196
1197    /// The wire type corresponding to [`GpioSetBufferModeRequest`].
1198    #[derive(Clone, Debug)]
1199    #[repr(C)]
1200    pub struct GpioSetBufferModeRequest {
1201        pub mode: crate::wire::BufferMode,
1202    }
1203
1204    static_assertions::const_assert_eq!(std::mem::size_of::<GpioSetBufferModeRequest>(), 4);
1205    static_assertions::const_assert_eq!(std::mem::align_of::<GpioSetBufferModeRequest>(), 4);
1206
1207    static_assertions::const_assert_eq!(std::mem::offset_of!(GpioSetBufferModeRequest, mode), 0);
1208
1209    impl ::fidl_next::Constrained for GpioSetBufferModeRequest {
1210        type Constraint = ();
1211
1212        fn validate(
1213            _: ::fidl_next::Slot<'_, Self>,
1214            _: Self::Constraint,
1215        ) -> Result<(), ::fidl_next::ValidationError> {
1216            Ok(())
1217        }
1218    }
1219
1220    unsafe impl ::fidl_next::Wire for GpioSetBufferModeRequest {
1221        type Narrowed<'de> = GpioSetBufferModeRequest;
1222
1223        #[inline]
1224        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1225            ::fidl_next::munge! {
1226                let Self {
1227                    mode,
1228
1229                } = &mut *out_;
1230            }
1231
1232            ::fidl_next::Wire::zero_padding(mode);
1233        }
1234    }
1235
1236    unsafe impl<___D> ::fidl_next::Decode<___D> for GpioSetBufferModeRequest
1237    where
1238        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1239    {
1240        fn decode(
1241            slot_: ::fidl_next::Slot<'_, Self>,
1242            decoder_: &mut ___D,
1243            _: (),
1244        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1245            ::fidl_next::munge! {
1246                let Self {
1247                    mut mode,
1248
1249                } = slot_;
1250            }
1251
1252            let _field = mode.as_mut();
1253
1254            ::fidl_next::Decode::decode(mode.as_mut(), decoder_, ())?;
1255
1256            Ok(())
1257        }
1258    }
1259
1260    impl ::fidl_next::IntoNatural for GpioSetBufferModeRequest {
1261        type Natural = crate::natural::GpioSetBufferModeRequest;
1262    }
1263
1264    /// The wire type corresponding to [`GpioSetBufferModeResponse`].
1265    pub type GpioSetBufferModeResponse = ::fidl_next::wire::Unit;
1266
1267    /// The wire type corresponding to [`InterruptMode`].
1268    #[derive(Clone, Copy, Debug, PartialEq, Eq)]
1269    #[repr(transparent)]
1270    pub struct InterruptMode {
1271        pub(crate) value: ::fidl_next::wire::Uint32,
1272    }
1273
1274    impl ::fidl_next::Constrained for InterruptMode {
1275        type Constraint = ();
1276
1277        fn validate(
1278            _: ::fidl_next::Slot<'_, Self>,
1279            _: Self::Constraint,
1280        ) -> Result<(), ::fidl_next::ValidationError> {
1281            Ok(())
1282        }
1283    }
1284
1285    unsafe impl ::fidl_next::Wire for InterruptMode {
1286        type Narrowed<'de> = Self;
1287
1288        #[inline]
1289        fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
1290            // Wire enums have no padding
1291        }
1292    }
1293
1294    impl InterruptMode {
1295        pub const EDGE_LOW: InterruptMode = InterruptMode { value: ::fidl_next::wire::Uint32(0) };
1296
1297        pub const EDGE_HIGH: InterruptMode = InterruptMode { value: ::fidl_next::wire::Uint32(1) };
1298
1299        pub const EDGE_BOTH: InterruptMode = InterruptMode { value: ::fidl_next::wire::Uint32(2) };
1300
1301        pub const LEVEL_LOW: InterruptMode = InterruptMode { value: ::fidl_next::wire::Uint32(3) };
1302
1303        pub const LEVEL_HIGH: InterruptMode = InterruptMode { value: ::fidl_next::wire::Uint32(4) };
1304    }
1305
1306    unsafe impl<___D> ::fidl_next::Decode<___D> for InterruptMode
1307    where
1308        ___D: ?Sized,
1309    {
1310        fn decode(
1311            slot: ::fidl_next::Slot<'_, Self>,
1312            _: &mut ___D,
1313            _: (),
1314        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1315            ::fidl_next::munge!(let Self { value } = slot);
1316
1317            match u32::from(*value) {
1318                0 | 1 | 2 | 3 | 4 => (),
1319                unknown => {
1320                    return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128));
1321                }
1322            }
1323
1324            Ok(())
1325        }
1326    }
1327
1328    impl ::core::convert::From<crate::natural::InterruptMode> for InterruptMode {
1329        fn from(natural: crate::natural::InterruptMode) -> Self {
1330            match natural {
1331                crate::natural::InterruptMode::EdgeLow => InterruptMode::EDGE_LOW,
1332
1333                crate::natural::InterruptMode::EdgeHigh => InterruptMode::EDGE_HIGH,
1334
1335                crate::natural::InterruptMode::EdgeBoth => InterruptMode::EDGE_BOTH,
1336
1337                crate::natural::InterruptMode::LevelLow => InterruptMode::LEVEL_LOW,
1338
1339                crate::natural::InterruptMode::LevelHigh => InterruptMode::LEVEL_HIGH,
1340            }
1341        }
1342    }
1343
1344    impl ::fidl_next::IntoNatural for InterruptMode {
1345        type Natural = crate::natural::InterruptMode;
1346    }
1347
1348    /// The wire type corresponding to [`InterruptConfiguration`].
1349    #[repr(C)]
1350    pub struct InterruptConfiguration<'de> {
1351        pub(crate) table: ::fidl_next::wire::Table<'de>,
1352    }
1353
1354    impl<'de> Drop for InterruptConfiguration<'de> {
1355        fn drop(&mut self) {
1356            let _ = self
1357                .table
1358                .get(1)
1359                .map(|envelope| unsafe { envelope.read_unchecked::<crate::wire::InterruptMode>() });
1360        }
1361    }
1362
1363    impl ::fidl_next::Constrained for InterruptConfiguration<'_> {
1364        type Constraint = ();
1365
1366        fn validate(
1367            _: ::fidl_next::Slot<'_, Self>,
1368            _: Self::Constraint,
1369        ) -> Result<(), ::fidl_next::ValidationError> {
1370            Ok(())
1371        }
1372    }
1373
1374    unsafe impl ::fidl_next::Wire for InterruptConfiguration<'static> {
1375        type Narrowed<'de> = InterruptConfiguration<'de>;
1376
1377        #[inline]
1378        fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
1379            ::fidl_next::munge!(let Self { table } = out);
1380            ::fidl_next::wire::Table::zero_padding(table);
1381        }
1382    }
1383
1384    unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for InterruptConfiguration<'de>
1385    where
1386        ___D: ::fidl_next::Decoder<'de> + ?Sized,
1387    {
1388        fn decode(
1389            slot: ::fidl_next::Slot<'_, Self>,
1390            decoder: &mut ___D,
1391            _: (),
1392        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1393            ::fidl_next::munge!(let Self { table } = slot);
1394
1395            ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
1396                match ordinal {
1397                    0 => unsafe { ::core::hint::unreachable_unchecked() },
1398
1399                    1 => {
1400                        ::fidl_next::wire::Envelope::decode_as::<___D, crate::wire::InterruptMode>(
1401                            slot.as_mut(),
1402                            decoder,
1403                            (),
1404                        )?;
1405
1406                        Ok(())
1407                    }
1408
1409                    _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
1410                }
1411            })
1412        }
1413    }
1414
1415    impl<'de> InterruptConfiguration<'de> {
1416        pub fn mode(&self) -> ::core::option::Option<&crate::wire::InterruptMode> {
1417            unsafe { Some(self.table.get(1)?.deref_unchecked()) }
1418        }
1419
1420        pub fn take_mode(&mut self) -> ::core::option::Option<crate::wire::InterruptMode> {
1421            unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
1422        }
1423    }
1424
1425    impl<'de> ::core::fmt::Debug for InterruptConfiguration<'de> {
1426        fn fmt(
1427            &self,
1428            f: &mut ::core::fmt::Formatter<'_>,
1429        ) -> ::core::result::Result<(), ::core::fmt::Error> {
1430            f.debug_struct("InterruptConfiguration").field("mode", &self.mode()).finish()
1431        }
1432    }
1433
1434    impl<'de> ::fidl_next::IntoNatural for InterruptConfiguration<'de> {
1435        type Natural = crate::natural::InterruptConfiguration;
1436    }
1437
1438    /// The wire type corresponding to [`GpioConfigureInterruptRequest`].
1439    #[derive(Debug)]
1440    #[repr(C)]
1441    pub struct GpioConfigureInterruptRequest<'de> {
1442        pub config: crate::wire::InterruptConfiguration<'de>,
1443    }
1444
1445    static_assertions::const_assert_eq!(
1446        std::mem::size_of::<GpioConfigureInterruptRequest<'_>>(),
1447        16
1448    );
1449    static_assertions::const_assert_eq!(
1450        std::mem::align_of::<GpioConfigureInterruptRequest<'_>>(),
1451        8
1452    );
1453
1454    static_assertions::const_assert_eq!(
1455        std::mem::offset_of!(GpioConfigureInterruptRequest<'_>, config),
1456        0
1457    );
1458
1459    impl ::fidl_next::Constrained for GpioConfigureInterruptRequest<'_> {
1460        type Constraint = ();
1461
1462        fn validate(
1463            _: ::fidl_next::Slot<'_, Self>,
1464            _: Self::Constraint,
1465        ) -> Result<(), ::fidl_next::ValidationError> {
1466            Ok(())
1467        }
1468    }
1469
1470    unsafe impl ::fidl_next::Wire for GpioConfigureInterruptRequest<'static> {
1471        type Narrowed<'de> = GpioConfigureInterruptRequest<'de>;
1472
1473        #[inline]
1474        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1475            ::fidl_next::munge! {
1476                let Self {
1477                    config,
1478
1479                } = &mut *out_;
1480            }
1481
1482            ::fidl_next::Wire::zero_padding(config);
1483        }
1484    }
1485
1486    unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for GpioConfigureInterruptRequest<'de>
1487    where
1488        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1489        ___D: ::fidl_next::Decoder<'de>,
1490    {
1491        fn decode(
1492            slot_: ::fidl_next::Slot<'_, Self>,
1493            decoder_: &mut ___D,
1494            _: (),
1495        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1496            ::fidl_next::munge! {
1497                let Self {
1498                    mut config,
1499
1500                } = slot_;
1501            }
1502
1503            let _field = config.as_mut();
1504
1505            ::fidl_next::Decode::decode(config.as_mut(), decoder_, ())?;
1506
1507            Ok(())
1508        }
1509    }
1510
1511    impl<'de> ::fidl_next::IntoNatural for GpioConfigureInterruptRequest<'de> {
1512        type Natural = crate::natural::GpioConfigureInterruptRequest;
1513    }
1514
1515    /// The wire type corresponding to [`GpioConfigureInterruptResponse`].
1516    pub type GpioConfigureInterruptResponse = ::fidl_next::wire::Unit;
1517
1518    /// The wire type corresponding to [`GpioReleaseInterruptResponse`].
1519    pub type GpioReleaseInterruptResponse = ::fidl_next::wire::Unit;
1520
1521    /// The wire type corresponding to [`InterruptOptions`](crate::natural::InterruptOptions).
1522    #[derive(Clone, Copy, Debug)]
1523    #[repr(transparent)]
1524    pub struct InterruptOptions {
1525        pub(crate) value: ::fidl_next::wire::Uint32,
1526    }
1527
1528    impl ::fidl_next::Constrained for InterruptOptions {
1529        type Constraint = ();
1530
1531        fn validate(
1532            _: ::fidl_next::Slot<'_, Self>,
1533            _: Self::Constraint,
1534        ) -> Result<(), ::fidl_next::ValidationError> {
1535            Ok(())
1536        }
1537    }
1538
1539    unsafe impl ::fidl_next::Wire for InterruptOptions {
1540        type Narrowed<'de> = Self;
1541
1542        #[inline]
1543        fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
1544            // Wire bits have no padding
1545        }
1546    }
1547
1548    unsafe impl<___D> ::fidl_next::Decode<___D> for InterruptOptions
1549    where
1550        ___D: ?Sized,
1551    {
1552        fn decode(
1553            slot: ::fidl_next::Slot<'_, Self>,
1554            _: &mut ___D,
1555            _: (),
1556        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1557            Ok(())
1558        }
1559    }
1560
1561    impl ::core::convert::From<crate::natural::InterruptOptions> for InterruptOptions {
1562        fn from(natural: crate::natural::InterruptOptions) -> Self {
1563            Self { value: ::fidl_next::wire::Uint32::from(natural.bits()) }
1564        }
1565    }
1566
1567    impl ::fidl_next::IntoNatural for InterruptOptions {
1568        type Natural = crate::natural::InterruptOptions;
1569    }
1570
1571    /// The wire type corresponding to [`GpioGetInterruptRequest`].
1572    #[derive(Clone, Debug)]
1573    #[repr(C)]
1574    pub struct GpioGetInterruptRequest {
1575        pub options: crate::wire::InterruptOptions,
1576    }
1577
1578    static_assertions::const_assert_eq!(std::mem::size_of::<GpioGetInterruptRequest>(), 4);
1579    static_assertions::const_assert_eq!(std::mem::align_of::<GpioGetInterruptRequest>(), 4);
1580
1581    static_assertions::const_assert_eq!(std::mem::offset_of!(GpioGetInterruptRequest, options), 0);
1582
1583    impl ::fidl_next::Constrained for GpioGetInterruptRequest {
1584        type Constraint = ();
1585
1586        fn validate(
1587            _: ::fidl_next::Slot<'_, Self>,
1588            _: Self::Constraint,
1589        ) -> Result<(), ::fidl_next::ValidationError> {
1590            Ok(())
1591        }
1592    }
1593
1594    unsafe impl ::fidl_next::Wire for GpioGetInterruptRequest {
1595        type Narrowed<'de> = GpioGetInterruptRequest;
1596
1597        #[inline]
1598        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1599            ::fidl_next::munge! {
1600                let Self {
1601                    options,
1602
1603                } = &mut *out_;
1604            }
1605
1606            ::fidl_next::Wire::zero_padding(options);
1607        }
1608    }
1609
1610    unsafe impl<___D> ::fidl_next::Decode<___D> for GpioGetInterruptRequest
1611    where
1612        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1613    {
1614        fn decode(
1615            slot_: ::fidl_next::Slot<'_, Self>,
1616            decoder_: &mut ___D,
1617            _: (),
1618        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1619            ::fidl_next::munge! {
1620                let Self {
1621                    mut options,
1622
1623                } = slot_;
1624            }
1625
1626            let _field = options.as_mut();
1627
1628            ::fidl_next::Decode::decode(options.as_mut(), decoder_, ())?;
1629
1630            Ok(())
1631        }
1632    }
1633
1634    impl ::fidl_next::IntoNatural for GpioGetInterruptRequest {
1635        type Natural = crate::natural::GpioGetInterruptRequest;
1636    }
1637}
1638
1639pub mod wire_optional {}
1640
1641pub mod generic {
1642
1643    /// The generic type corresponding to [`GpioReadResponse`].
1644    pub struct GpioReadResponse<T0> {
1645        pub value: T0,
1646    }
1647
1648    unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::GpioReadResponse, ___E>
1649        for GpioReadResponse<T0>
1650    where
1651        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1652        T0: ::fidl_next::Encode<bool, ___E>,
1653    {
1654        #[inline]
1655        fn encode(
1656            self,
1657            encoder_: &mut ___E,
1658            out_: &mut ::core::mem::MaybeUninit<crate::wire::GpioReadResponse>,
1659            _: (),
1660        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1661            ::fidl_next::munge! {
1662                let crate::wire::GpioReadResponse {
1663                    value,
1664
1665                } = out_;
1666            }
1667
1668            ::fidl_next::Encode::encode(self.value, encoder_, value, ())?;
1669
1670            Ok(())
1671        }
1672    }
1673
1674    /// The generic type corresponding to [`GpioSetBufferModeRequest`].
1675    pub struct GpioSetBufferModeRequest<T0> {
1676        pub mode: T0,
1677    }
1678
1679    unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::GpioSetBufferModeRequest, ___E>
1680        for GpioSetBufferModeRequest<T0>
1681    where
1682        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1683        T0: ::fidl_next::Encode<crate::wire::BufferMode, ___E>,
1684    {
1685        #[inline]
1686        fn encode(
1687            self,
1688            encoder_: &mut ___E,
1689            out_: &mut ::core::mem::MaybeUninit<crate::wire::GpioSetBufferModeRequest>,
1690            _: (),
1691        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1692            ::fidl_next::munge! {
1693                let crate::wire::GpioSetBufferModeRequest {
1694                    mode,
1695
1696                } = out_;
1697            }
1698
1699            ::fidl_next::Encode::encode(self.mode, encoder_, mode, ())?;
1700
1701            Ok(())
1702        }
1703    }
1704
1705    /// The generic type corresponding to [`GpioSetBufferModeResponse`].
1706    pub type GpioSetBufferModeResponse = ();
1707
1708    /// The generic type corresponding to [`GpioConfigureInterruptRequest`].
1709    pub struct GpioConfigureInterruptRequest<T0> {
1710        pub config: T0,
1711    }
1712
1713    unsafe impl<___E, T0>
1714        ::fidl_next::Encode<crate::wire::GpioConfigureInterruptRequest<'static>, ___E>
1715        for GpioConfigureInterruptRequest<T0>
1716    where
1717        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1718        ___E: ::fidl_next::Encoder,
1719        T0: ::fidl_next::Encode<crate::wire::InterruptConfiguration<'static>, ___E>,
1720    {
1721        #[inline]
1722        fn encode(
1723            self,
1724            encoder_: &mut ___E,
1725            out_: &mut ::core::mem::MaybeUninit<
1726                crate::wire::GpioConfigureInterruptRequest<'static>,
1727            >,
1728            _: (),
1729        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1730            ::fidl_next::munge! {
1731                let crate::wire::GpioConfigureInterruptRequest {
1732                    config,
1733
1734                } = out_;
1735            }
1736
1737            ::fidl_next::Encode::encode(self.config, encoder_, config, ())?;
1738
1739            Ok(())
1740        }
1741    }
1742
1743    /// The generic type corresponding to [`GpioConfigureInterruptResponse`].
1744    pub type GpioConfigureInterruptResponse = ();
1745
1746    /// The generic type corresponding to [`GpioReleaseInterruptResponse`].
1747    pub type GpioReleaseInterruptResponse = ();
1748
1749    /// The generic type corresponding to [`GpioGetInterruptRequest`].
1750    pub struct GpioGetInterruptRequest<T0> {
1751        pub options: T0,
1752    }
1753
1754    unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::GpioGetInterruptRequest, ___E>
1755        for GpioGetInterruptRequest<T0>
1756    where
1757        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1758        T0: ::fidl_next::Encode<crate::wire::InterruptOptions, ___E>,
1759    {
1760        #[inline]
1761        fn encode(
1762            self,
1763            encoder_: &mut ___E,
1764            out_: &mut ::core::mem::MaybeUninit<crate::wire::GpioGetInterruptRequest>,
1765            _: (),
1766        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1767            ::fidl_next::munge! {
1768                let crate::wire::GpioGetInterruptRequest {
1769                    options,
1770
1771                } = out_;
1772            }
1773
1774            ::fidl_next::Encode::encode(self.options, encoder_, options, ())?;
1775
1776            Ok(())
1777        }
1778    }
1779}
1780
1781pub use self::natural::*;
1782
1783pub const SIGNAL_ACK_INTERRUPT: u32 = 16777216 as u32;