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 name(&self) -> ::core::option::Option<&::fidl_next::wire::String<'de>> {
924            unsafe { Some(self.table.get(2)?.deref_unchecked()) }
925        }
926    }
927
928    impl<'de> ::core::fmt::Debug for AdcChannel<'de> {
929        fn fmt(
930            &self,
931            f: &mut ::core::fmt::Formatter<'_>,
932        ) -> ::core::result::Result<(), ::core::fmt::Error> {
933            f.debug_struct("AdcChannel")
934                .field("idx", &self.idx())
935                .field("name", &self.name())
936                .finish()
937        }
938    }
939
940    impl<'de> ::fidl_next::IntoNatural for AdcChannel<'de> {
941        type Natural = crate::natural::AdcChannel;
942    }
943
944    /// The wire type corresponding to [`DeviceGetResolutionResponse`].
945    #[derive(Clone, Debug)]
946    #[repr(C)]
947    pub struct DeviceGetResolutionResponse {
948        pub resolution: u8,
949    }
950
951    static_assertions::const_assert_eq!(std::mem::size_of::<DeviceGetResolutionResponse>(), 1);
952    static_assertions::const_assert_eq!(std::mem::align_of::<DeviceGetResolutionResponse>(), 1);
953
954    static_assertions::const_assert_eq!(
955        std::mem::offset_of!(DeviceGetResolutionResponse, resolution),
956        0
957    );
958
959    impl ::fidl_next::Constrained for DeviceGetResolutionResponse {
960        type Constraint = ();
961
962        fn validate(
963            _: ::fidl_next::Slot<'_, Self>,
964            _: Self::Constraint,
965        ) -> Result<(), ::fidl_next::ValidationError> {
966            Ok(())
967        }
968    }
969
970    unsafe impl ::fidl_next::Wire for DeviceGetResolutionResponse {
971        type Narrowed<'de> = DeviceGetResolutionResponse;
972
973        #[inline]
974        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
975            ::fidl_next::munge! {
976                let Self {
977                    resolution,
978
979                } = &mut *out_;
980            }
981
982            ::fidl_next::Wire::zero_padding(resolution);
983        }
984    }
985
986    unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceGetResolutionResponse
987    where
988        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
989    {
990        fn decode(
991            slot_: ::fidl_next::Slot<'_, Self>,
992            decoder_: &mut ___D,
993            _: (),
994        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
995            ::fidl_next::munge! {
996                let Self {
997                    mut resolution,
998
999                } = slot_;
1000            }
1001
1002            let _field = resolution.as_mut();
1003
1004            ::fidl_next::Decode::decode(resolution.as_mut(), decoder_, ())?;
1005
1006            Ok(())
1007        }
1008    }
1009
1010    impl ::fidl_next::IntoNatural for DeviceGetResolutionResponse {
1011        type Natural = crate::natural::DeviceGetResolutionResponse;
1012    }
1013
1014    /// The wire type corresponding to [`DeviceGetSampleRequest`].
1015    #[derive(Clone, Debug)]
1016    #[repr(C)]
1017    pub struct DeviceGetSampleRequest {
1018        pub channel_id: ::fidl_next::wire::Uint32,
1019    }
1020
1021    static_assertions::const_assert_eq!(std::mem::size_of::<DeviceGetSampleRequest>(), 4);
1022    static_assertions::const_assert_eq!(std::mem::align_of::<DeviceGetSampleRequest>(), 4);
1023
1024    static_assertions::const_assert_eq!(
1025        std::mem::offset_of!(DeviceGetSampleRequest, channel_id),
1026        0
1027    );
1028
1029    impl ::fidl_next::Constrained for DeviceGetSampleRequest {
1030        type Constraint = ();
1031
1032        fn validate(
1033            _: ::fidl_next::Slot<'_, Self>,
1034            _: Self::Constraint,
1035        ) -> Result<(), ::fidl_next::ValidationError> {
1036            Ok(())
1037        }
1038    }
1039
1040    unsafe impl ::fidl_next::Wire for DeviceGetSampleRequest {
1041        type Narrowed<'de> = DeviceGetSampleRequest;
1042
1043        #[inline]
1044        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1045            ::fidl_next::munge! {
1046                let Self {
1047                    channel_id,
1048
1049                } = &mut *out_;
1050            }
1051
1052            ::fidl_next::Wire::zero_padding(channel_id);
1053        }
1054    }
1055
1056    unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceGetSampleRequest
1057    where
1058        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1059    {
1060        fn decode(
1061            slot_: ::fidl_next::Slot<'_, Self>,
1062            decoder_: &mut ___D,
1063            _: (),
1064        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1065            ::fidl_next::munge! {
1066                let Self {
1067                    mut channel_id,
1068
1069                } = slot_;
1070            }
1071
1072            let _field = channel_id.as_mut();
1073
1074            ::fidl_next::Decode::decode(channel_id.as_mut(), decoder_, ())?;
1075
1076            Ok(())
1077        }
1078    }
1079
1080    impl ::fidl_next::IntoNatural for DeviceGetSampleRequest {
1081        type Natural = crate::natural::DeviceGetSampleRequest;
1082    }
1083
1084    /// The wire type corresponding to [`DeviceGetSampleResponse`].
1085    #[derive(Clone, Debug)]
1086    #[repr(C)]
1087    pub struct DeviceGetSampleResponse {
1088        pub value: ::fidl_next::wire::Uint32,
1089    }
1090
1091    static_assertions::const_assert_eq!(std::mem::size_of::<DeviceGetSampleResponse>(), 4);
1092    static_assertions::const_assert_eq!(std::mem::align_of::<DeviceGetSampleResponse>(), 4);
1093
1094    static_assertions::const_assert_eq!(std::mem::offset_of!(DeviceGetSampleResponse, value), 0);
1095
1096    impl ::fidl_next::Constrained for DeviceGetSampleResponse {
1097        type Constraint = ();
1098
1099        fn validate(
1100            _: ::fidl_next::Slot<'_, Self>,
1101            _: Self::Constraint,
1102        ) -> Result<(), ::fidl_next::ValidationError> {
1103            Ok(())
1104        }
1105    }
1106
1107    unsafe impl ::fidl_next::Wire for DeviceGetSampleResponse {
1108        type Narrowed<'de> = DeviceGetSampleResponse;
1109
1110        #[inline]
1111        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1112            ::fidl_next::munge! {
1113                let Self {
1114                    value,
1115
1116                } = &mut *out_;
1117            }
1118
1119            ::fidl_next::Wire::zero_padding(value);
1120        }
1121    }
1122
1123    unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceGetSampleResponse
1124    where
1125        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1126    {
1127        fn decode(
1128            slot_: ::fidl_next::Slot<'_, Self>,
1129            decoder_: &mut ___D,
1130            _: (),
1131        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1132            ::fidl_next::munge! {
1133                let Self {
1134                    mut value,
1135
1136                } = slot_;
1137            }
1138
1139            let _field = value.as_mut();
1140
1141            ::fidl_next::Decode::decode(value.as_mut(), decoder_, ())?;
1142
1143            Ok(())
1144        }
1145    }
1146
1147    impl ::fidl_next::IntoNatural for DeviceGetSampleResponse {
1148        type Natural = crate::natural::DeviceGetSampleResponse;
1149    }
1150
1151    /// The wire type corresponding to [`Metadata`].
1152    #[repr(C)]
1153    pub struct Metadata<'de> {
1154        pub(crate) table: ::fidl_next::wire::Table<'de>,
1155    }
1156
1157    impl<'de> Drop for Metadata<'de> {
1158        fn drop(&mut self) {
1159            let _ = self.table.get(1).map(|envelope| unsafe {
1160                envelope
1161                    .read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::AdcChannel<'de>>>(
1162                    )
1163            });
1164        }
1165    }
1166
1167    impl ::fidl_next::Constrained for Metadata<'_> {
1168        type Constraint = ();
1169
1170        fn validate(
1171            _: ::fidl_next::Slot<'_, Self>,
1172            _: Self::Constraint,
1173        ) -> Result<(), ::fidl_next::ValidationError> {
1174            Ok(())
1175        }
1176    }
1177
1178    unsafe impl ::fidl_next::Wire for Metadata<'static> {
1179        type Narrowed<'de> = Metadata<'de>;
1180
1181        #[inline]
1182        fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
1183            ::fidl_next::munge!(let Self { table } = out);
1184            ::fidl_next::wire::Table::zero_padding(table);
1185        }
1186    }
1187
1188    unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for Metadata<'de>
1189    where
1190        ___D: ::fidl_next::Decoder<'de> + ?Sized,
1191    {
1192        fn decode(
1193            slot: ::fidl_next::Slot<'_, Self>,
1194            decoder: &mut ___D,
1195            _: (),
1196        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1197            ::fidl_next::munge!(let Self { table } = slot);
1198
1199            ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
1200                match ordinal {
1201                    0 => unsafe { ::core::hint::unreachable_unchecked() },
1202
1203                    1 => {
1204                        ::fidl_next::wire::Envelope::decode_as::<
1205                            ___D,
1206                            ::fidl_next::wire::Vector<'de, crate::wire::AdcChannel<'de>>,
1207                        >(slot.as_mut(), decoder, (4294967295, ()))?;
1208
1209                        Ok(())
1210                    }
1211
1212                    _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
1213                }
1214            })
1215        }
1216    }
1217
1218    impl<'de> Metadata<'de> {
1219        pub fn channels(
1220            &self,
1221        ) -> ::core::option::Option<&::fidl_next::wire::Vector<'de, crate::wire::AdcChannel<'de>>>
1222        {
1223            unsafe { Some(self.table.get(1)?.deref_unchecked()) }
1224        }
1225    }
1226
1227    impl<'de> ::core::fmt::Debug for Metadata<'de> {
1228        fn fmt(
1229            &self,
1230            f: &mut ::core::fmt::Formatter<'_>,
1231        ) -> ::core::result::Result<(), ::core::fmt::Error> {
1232            f.debug_struct("Metadata").field("channels", &self.channels()).finish()
1233        }
1234    }
1235
1236    impl<'de> ::fidl_next::IntoNatural for Metadata<'de> {
1237        type Natural = crate::natural::Metadata;
1238    }
1239}
1240
1241pub mod wire_optional {}
1242
1243pub mod generic {
1244
1245    /// The generic type corresponding to [`DeviceGetResolutionResponse`].
1246    pub struct DeviceGetResolutionResponse<T0> {
1247        pub resolution: T0,
1248    }
1249
1250    unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceGetResolutionResponse, ___E>
1251        for DeviceGetResolutionResponse<T0>
1252    where
1253        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1254        T0: ::fidl_next::Encode<u8, ___E>,
1255    {
1256        #[inline]
1257        fn encode(
1258            self,
1259            encoder_: &mut ___E,
1260            out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetResolutionResponse>,
1261            _: (),
1262        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1263            ::fidl_next::munge! {
1264                let crate::wire::DeviceGetResolutionResponse {
1265                    resolution,
1266
1267                } = out_;
1268            }
1269
1270            ::fidl_next::Encode::encode(self.resolution, encoder_, resolution, ())?;
1271
1272            Ok(())
1273        }
1274    }
1275
1276    /// The generic type corresponding to [`DeviceGetSampleRequest`].
1277    pub struct DeviceGetSampleRequest<T0> {
1278        pub channel_id: T0,
1279    }
1280
1281    unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceGetSampleRequest, ___E>
1282        for DeviceGetSampleRequest<T0>
1283    where
1284        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1285        T0: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
1286    {
1287        #[inline]
1288        fn encode(
1289            self,
1290            encoder_: &mut ___E,
1291            out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetSampleRequest>,
1292            _: (),
1293        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1294            ::fidl_next::munge! {
1295                let crate::wire::DeviceGetSampleRequest {
1296                    channel_id,
1297
1298                } = out_;
1299            }
1300
1301            ::fidl_next::Encode::encode(self.channel_id, encoder_, channel_id, ())?;
1302
1303            Ok(())
1304        }
1305    }
1306
1307    /// The generic type corresponding to [`DeviceGetSampleResponse`].
1308    pub struct DeviceGetSampleResponse<T0> {
1309        pub value: T0,
1310    }
1311
1312    unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceGetSampleResponse, ___E>
1313        for DeviceGetSampleResponse<T0>
1314    where
1315        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1316        T0: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
1317    {
1318        #[inline]
1319        fn encode(
1320            self,
1321            encoder_: &mut ___E,
1322            out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetSampleResponse>,
1323            _: (),
1324        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1325            ::fidl_next::munge! {
1326                let crate::wire::DeviceGetSampleResponse {
1327                    value,
1328
1329                } = out_;
1330            }
1331
1332            ::fidl_next::Encode::encode(self.value, encoder_, value, ())?;
1333
1334            Ok(())
1335        }
1336    }
1337}
1338
1339pub use self::natural::*;
1340
1341pub const ADC_NAME_MAX_LENGTH: u32 = 64 as u32;
1342
1343/// The type corresponding to the Device protocol.
1344#[derive(PartialEq, Debug)]
1345pub struct Device;
1346
1347#[cfg(feature = "driver")]
1348impl ::fidl_next::HasTransport for Device {
1349    type Transport = ::fdf_fidl::DriverChannel;
1350}
1351
1352pub mod device {
1353    pub mod prelude {
1354        pub use crate::{
1355            Device, DeviceClientHandler, DeviceLocalClientHandler, DeviceLocalServerHandler,
1356            DeviceServerHandler, device,
1357        };
1358
1359        pub use crate::natural::DeviceGetSampleRequest;
1360
1361        pub use crate::natural::DeviceGetResolutionResponse;
1362
1363        pub use crate::natural::DeviceGetSampleResponse;
1364    }
1365
1366    pub struct GetResolution;
1367
1368    impl ::fidl_next::Method for GetResolution {
1369        const ORDINAL: u64 = 4046989155806520419;
1370        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1371            ::fidl_next::protocol::Flexibility::Strict;
1372
1373        type Protocol = crate::Device;
1374
1375        type Request = ::fidl_next::wire::EmptyMessageBody;
1376    }
1377
1378    impl ::fidl_next::TwoWayMethod for GetResolution {
1379        type Response = ::fidl_next::wire::Result<
1380            'static,
1381            crate::wire::DeviceGetResolutionResponse,
1382            ::fidl_next::wire::Int32,
1383        >;
1384    }
1385
1386    impl<___R> ::fidl_next::Respond<___R> for GetResolution {
1387        type Output = ::core::result::Result<
1388            crate::generic::DeviceGetResolutionResponse<___R>,
1389            ::fidl_next::util::Never,
1390        >;
1391
1392        fn respond(response: ___R) -> Self::Output {
1393            ::core::result::Result::Ok(crate::generic::DeviceGetResolutionResponse {
1394                resolution: response,
1395            })
1396        }
1397    }
1398
1399    impl<___R> ::fidl_next::RespondErr<___R> for GetResolution {
1400        type Output = ::core::result::Result<::fidl_next::util::Never, ___R>;
1401
1402        fn respond_err(response: ___R) -> Self::Output {
1403            ::core::result::Result::Err(response)
1404        }
1405    }
1406
1407    pub struct GetSample;
1408
1409    impl ::fidl_next::Method for GetSample {
1410        const ORDINAL: u64 = 3324445366106306278;
1411        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1412            ::fidl_next::protocol::Flexibility::Strict;
1413
1414        type Protocol = crate::Device;
1415
1416        type Request = crate::wire::DeviceGetSampleRequest;
1417    }
1418
1419    impl ::fidl_next::TwoWayMethod for GetSample {
1420        type Response = ::fidl_next::wire::Result<
1421            'static,
1422            crate::wire::DeviceGetSampleResponse,
1423            ::fidl_next::wire::Int32,
1424        >;
1425    }
1426
1427    impl<___R> ::fidl_next::Respond<___R> for GetSample {
1428        type Output = ::core::result::Result<
1429            crate::generic::DeviceGetSampleResponse<___R>,
1430            ::fidl_next::util::Never,
1431        >;
1432
1433        fn respond(response: ___R) -> Self::Output {
1434            ::core::result::Result::Ok(crate::generic::DeviceGetSampleResponse { value: response })
1435        }
1436    }
1437
1438    impl<___R> ::fidl_next::RespondErr<___R> for GetSample {
1439        type Output = ::core::result::Result<::fidl_next::util::Never, ___R>;
1440
1441        fn respond_err(response: ___R) -> Self::Output {
1442            ::core::result::Result::Err(response)
1443        }
1444    }
1445
1446    mod ___detail {
1447        unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Device
1448        where
1449            ___T: ::fidl_next::Transport,
1450        {
1451            type Client = DeviceClient<___T>;
1452            type Server = DeviceServer<___T>;
1453        }
1454
1455        /// The client for the `Device` protocol.
1456        #[repr(transparent)]
1457        pub struct DeviceClient<___T: ::fidl_next::Transport> {
1458            #[allow(dead_code)]
1459            client: ::fidl_next::protocol::Client<___T>,
1460        }
1461
1462        impl<___T> DeviceClient<___T>
1463        where
1464            ___T: ::fidl_next::Transport,
1465        {
1466            #[doc = " Get adc resolution in number of bits.\n"]
1467            pub fn get_resolution(
1468                &self,
1469            ) -> ::fidl_next::TwoWayFuture<'_, super::GetResolution, ___T> {
1470                ::fidl_next::TwoWayFuture::from_untyped(
1471                    self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
1472                        4046989155806520419,
1473                        <super::GetResolution as ::fidl_next::Method>::FLEXIBILITY,
1474                        (),
1475                    ),
1476                )
1477            }
1478
1479            #[doc = " Get sample - raw count from adc - of the ADC channel indicated by\n channel_id.\n"]
1480            pub fn get_sample(
1481                &self,
1482
1483                channel_id: impl ::fidl_next::Encode<
1484                    ::fidl_next::wire::Uint32,
1485                    <___T as ::fidl_next::Transport>::SendBuffer,
1486                >,
1487            ) -> ::fidl_next::TwoWayFuture<'_, super::GetSample, ___T>
1488            where
1489                <___T as ::fidl_next::Transport>::SendBuffer:
1490                    ::fidl_next::encoder::InternalHandleEncoder,
1491            {
1492                self.get_sample_with(crate::generic::DeviceGetSampleRequest { channel_id })
1493            }
1494
1495            #[doc = " Get sample - raw count from adc - of the ADC channel indicated by\n channel_id.\n"]
1496            pub fn get_sample_with<___R>(
1497                &self,
1498                request: ___R,
1499            ) -> ::fidl_next::TwoWayFuture<'_, super::GetSample, ___T>
1500            where
1501                ___R: ::fidl_next::Encode<
1502                        crate::wire::DeviceGetSampleRequest,
1503                        <___T as ::fidl_next::Transport>::SendBuffer,
1504                    >,
1505            {
1506                ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1507                    3324445366106306278,
1508                    <super::GetSample as ::fidl_next::Method>::FLEXIBILITY,
1509                    request,
1510                ))
1511            }
1512        }
1513
1514        /// The server for the `Device` protocol.
1515        #[repr(transparent)]
1516        pub struct DeviceServer<___T: ::fidl_next::Transport> {
1517            server: ::fidl_next::protocol::Server<___T>,
1518        }
1519
1520        impl<___T> DeviceServer<___T> where ___T: ::fidl_next::Transport {}
1521    }
1522}
1523
1524#[diagnostic::on_unimplemented(
1525    note = "If {Self} implements the non-local DeviceClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
1526)]
1527
1528/// A client handler for the Device protocol.
1529///
1530/// See [`Device`] for more details.
1531pub trait DeviceLocalClientHandler<
1532    #[cfg(feature = "driver")] ___T: ::fidl_next::Transport = ::fdf_fidl::DriverChannel,
1533    #[cfg(not(feature = "driver"))] ___T: ::fidl_next::Transport,
1534>
1535{
1536}
1537
1538impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Device
1539where
1540    ___H: DeviceLocalClientHandler<___T>,
1541    ___T: ::fidl_next::Transport,
1542{
1543    async fn on_event(
1544        handler: &mut ___H,
1545        ordinal: u64,
1546        flexibility: ::fidl_next::protocol::Flexibility,
1547        body: ::fidl_next::Body<___T>,
1548    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1549        match ordinal {
1550            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
1551        }
1552    }
1553}
1554
1555#[diagnostic::on_unimplemented(
1556    note = "If {Self} implements the non-local DeviceServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
1557)]
1558
1559/// A server handler for the Device protocol.
1560///
1561/// See [`Device`] for more details.
1562pub trait DeviceLocalServerHandler<
1563    #[cfg(feature = "driver")] ___T: ::fidl_next::Transport = ::fdf_fidl::DriverChannel,
1564    #[cfg(not(feature = "driver"))] ___T: ::fidl_next::Transport,
1565>
1566{
1567    #[doc = " Get adc resolution in number of bits.\n"]
1568    fn get_resolution(
1569        &mut self,
1570
1571        responder: ::fidl_next::Responder<device::GetResolution, ___T>,
1572    ) -> impl ::core::future::Future<Output = ()>;
1573
1574    #[doc = " Get sample - raw count from adc - of the ADC channel indicated by\n channel_id.\n"]
1575    fn get_sample(
1576        &mut self,
1577
1578        request: ::fidl_next::Request<device::GetSample, ___T>,
1579
1580        responder: ::fidl_next::Responder<device::GetSample, ___T>,
1581    ) -> impl ::core::future::Future<Output = ()>;
1582}
1583
1584impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Device
1585where
1586    ___H: DeviceLocalServerHandler<___T>,
1587    ___T: ::fidl_next::Transport,
1588    for<'de> crate::wire::DeviceGetSampleRequest: ::fidl_next::Decode<
1589            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1590            Constraint = (),
1591        >,
1592{
1593    async fn on_one_way(
1594        handler: &mut ___H,
1595        ordinal: u64,
1596        flexibility: ::fidl_next::protocol::Flexibility,
1597        body: ::fidl_next::Body<___T>,
1598    ) -> ::core::result::Result<
1599        (),
1600        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1601    > {
1602        match ordinal {
1603            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
1604        }
1605    }
1606
1607    async fn on_two_way(
1608        handler: &mut ___H,
1609        ordinal: u64,
1610        flexibility: ::fidl_next::protocol::Flexibility,
1611        body: ::fidl_next::Body<___T>,
1612        responder: ::fidl_next::protocol::Responder<___T>,
1613    ) -> ::core::result::Result<
1614        (),
1615        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1616    > {
1617        match ordinal {
1618            4046989155806520419 => {
1619                let responder = ::fidl_next::Responder::from_untyped(responder);
1620
1621                handler.get_resolution(responder).await;
1622                Ok(())
1623            }
1624
1625            3324445366106306278 => {
1626                let responder = ::fidl_next::Responder::from_untyped(responder);
1627
1628                match ::fidl_next::AsDecoderExt::into_decoded(body) {
1629                    Ok(decoded) => {
1630                        handler
1631                            .get_sample(::fidl_next::Request::from_decoded(decoded), responder)
1632                            .await;
1633                        Ok(())
1634                    }
1635                    Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1636                        ordinal: 3324445366106306278,
1637                        error,
1638                    }),
1639                }
1640            }
1641
1642            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
1643        }
1644    }
1645}
1646
1647/// A client handler for the Device protocol.
1648///
1649/// See [`Device`] for more details.
1650pub trait DeviceClientHandler<
1651    #[cfg(feature = "driver")] ___T: ::fidl_next::Transport = ::fdf_fidl::DriverChannel,
1652    #[cfg(not(feature = "driver"))] ___T: ::fidl_next::Transport,
1653>
1654{
1655}
1656
1657impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Device
1658where
1659    ___H: DeviceClientHandler<___T> + ::core::marker::Send,
1660    ___T: ::fidl_next::Transport,
1661{
1662    async fn on_event(
1663        handler: &mut ___H,
1664        ordinal: u64,
1665        flexibility: ::fidl_next::protocol::Flexibility,
1666        body: ::fidl_next::Body<___T>,
1667    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1668        match ordinal {
1669            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
1670        }
1671    }
1672}
1673
1674/// A server handler for the Device protocol.
1675///
1676/// See [`Device`] for more details.
1677pub trait DeviceServerHandler<
1678    #[cfg(feature = "driver")] ___T: ::fidl_next::Transport = ::fdf_fidl::DriverChannel,
1679    #[cfg(not(feature = "driver"))] ___T: ::fidl_next::Transport,
1680>
1681{
1682    #[doc = " Get adc resolution in number of bits.\n"]
1683    fn get_resolution(
1684        &mut self,
1685
1686        responder: ::fidl_next::Responder<device::GetResolution, ___T>,
1687    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1688
1689    #[doc = " Get sample - raw count from adc - of the ADC channel indicated by\n channel_id.\n"]
1690    fn get_sample(
1691        &mut self,
1692
1693        request: ::fidl_next::Request<device::GetSample, ___T>,
1694
1695        responder: ::fidl_next::Responder<device::GetSample, ___T>,
1696    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1697}
1698
1699impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Device
1700where
1701    ___H: DeviceServerHandler<___T> + ::core::marker::Send,
1702    ___T: ::fidl_next::Transport,
1703    for<'de> crate::wire::DeviceGetSampleRequest: ::fidl_next::Decode<
1704            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1705            Constraint = (),
1706        >,
1707{
1708    async fn on_one_way(
1709        handler: &mut ___H,
1710        ordinal: u64,
1711        flexibility: ::fidl_next::protocol::Flexibility,
1712        body: ::fidl_next::Body<___T>,
1713    ) -> ::core::result::Result<
1714        (),
1715        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1716    > {
1717        match ordinal {
1718            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
1719        }
1720    }
1721
1722    async fn on_two_way(
1723        handler: &mut ___H,
1724        ordinal: u64,
1725        flexibility: ::fidl_next::protocol::Flexibility,
1726        body: ::fidl_next::Body<___T>,
1727        responder: ::fidl_next::protocol::Responder<___T>,
1728    ) -> ::core::result::Result<
1729        (),
1730        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1731    > {
1732        match ordinal {
1733            4046989155806520419 => {
1734                let responder = ::fidl_next::Responder::from_untyped(responder);
1735
1736                handler.get_resolution(responder).await;
1737                Ok(())
1738            }
1739
1740            3324445366106306278 => {
1741                let responder = ::fidl_next::Responder::from_untyped(responder);
1742
1743                match ::fidl_next::AsDecoderExt::into_decoded(body) {
1744                    Ok(decoded) => {
1745                        handler
1746                            .get_sample(::fidl_next::Request::from_decoded(decoded), responder)
1747                            .await;
1748                        Ok(())
1749                    }
1750                    Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1751                        ordinal: 3324445366106306278,
1752                        error,
1753                    }),
1754                }
1755            }
1756
1757            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
1758        }
1759    }
1760}
1761
1762impl<___T> DeviceClientHandler<___T> for ::fidl_next::IgnoreEvents where ___T: ::fidl_next::Transport
1763{}
1764
1765impl<___H, ___T> DeviceLocalClientHandler<___T> for ::fidl_next::Local<___H>
1766where
1767    ___H: DeviceClientHandler<___T>,
1768    ___T: ::fidl_next::Transport,
1769{
1770}
1771
1772impl<___H, ___T> DeviceLocalServerHandler<___T> for ::fidl_next::Local<___H>
1773where
1774    ___H: DeviceServerHandler<___T>,
1775    ___T: ::fidl_next::Transport,
1776{
1777    async fn get_resolution(
1778        &mut self,
1779
1780        responder: ::fidl_next::Responder<device::GetResolution, ___T>,
1781    ) {
1782        ___H::get_resolution(&mut self.0, responder).await
1783    }
1784
1785    async fn get_sample(
1786        &mut self,
1787
1788        request: ::fidl_next::Request<device::GetSample, ___T>,
1789
1790        responder: ::fidl_next::Responder<device::GetSample, ___T>,
1791    ) {
1792        ___H::get_sample(&mut self.0, request, responder).await
1793    }
1794}