Skip to main content

fidl_next_common_fuchsia_hardware_adcimpl/
fidl_next_common_fuchsia_hardware_adcimpl.rs

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