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