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