Skip to main content

fidl_next_common_fuchsia_hardware_i2c/
fidl_next_common_fuchsia_hardware_i2c.rs

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