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
468                    transactions,
469
470                } = out_;
471            }
472
473            ::fidl_next::Encode::encode(&self.transactions, encoder_, transactions, (256, ()))?;
474
475            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(transactions.as_mut_ptr()) };
476            ::fidl_next::Constrained::validate(_field, (256, ()))?;
477
478            Ok(())
479        }
480    }
481
482    unsafe impl<___E>
483        ::fidl_next::EncodeOption<
484            ::fidl_next::wire::Box<'static, crate::wire::DeviceTransferRequest<'static>>,
485            ___E,
486        > for DeviceTransferRequest
487    where
488        ___E: ::fidl_next::Encoder + ?Sized,
489        DeviceTransferRequest:
490            ::fidl_next::Encode<crate::wire::DeviceTransferRequest<'static>, ___E>,
491    {
492        #[inline]
493        fn encode_option(
494            this: ::core::option::Option<Self>,
495            encoder: &mut ___E,
496            out: &mut ::core::mem::MaybeUninit<
497                ::fidl_next::wire::Box<'static, crate::wire::DeviceTransferRequest<'static>>,
498            >,
499            _: (),
500        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
501            if let Some(inner) = this {
502                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
503                ::fidl_next::wire::Box::encode_present(out);
504            } else {
505                ::fidl_next::wire::Box::encode_absent(out);
506            }
507
508            Ok(())
509        }
510    }
511
512    unsafe impl<'a, ___E>
513        ::fidl_next::EncodeOption<
514            ::fidl_next::wire::Box<'static, crate::wire::DeviceTransferRequest<'static>>,
515            ___E,
516        > for &'a DeviceTransferRequest
517    where
518        ___E: ::fidl_next::Encoder + ?Sized,
519        &'a DeviceTransferRequest:
520            ::fidl_next::Encode<crate::wire::DeviceTransferRequest<'static>, ___E>,
521    {
522        #[inline]
523        fn encode_option(
524            this: ::core::option::Option<Self>,
525            encoder: &mut ___E,
526            out: &mut ::core::mem::MaybeUninit<
527                ::fidl_next::wire::Box<'static, crate::wire::DeviceTransferRequest<'static>>,
528            >,
529            _: (),
530        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
531            if let Some(inner) = this {
532                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
533                ::fidl_next::wire::Box::encode_present(out);
534            } else {
535                ::fidl_next::wire::Box::encode_absent(out);
536            }
537
538            Ok(())
539        }
540    }
541
542    impl<'de> ::fidl_next::FromWire<crate::wire::DeviceTransferRequest<'de>> for DeviceTransferRequest {
543        #[inline]
544        fn from_wire(wire: crate::wire::DeviceTransferRequest<'de>) -> Self {
545            Self { transactions: ::fidl_next::FromWire::from_wire(wire.transactions) }
546        }
547    }
548
549    impl<'de> ::fidl_next::FromWireRef<crate::wire::DeviceTransferRequest<'de>>
550        for DeviceTransferRequest
551    {
552        #[inline]
553        fn from_wire_ref(wire: &crate::wire::DeviceTransferRequest<'de>) -> Self {
554            Self { transactions: ::fidl_next::FromWireRef::from_wire_ref(&wire.transactions) }
555        }
556    }
557
558    #[doc = " Used to return data from read transfers.\n"]
559    pub type ReadData = ::std::vec::Vec<u8>;
560
561    #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
562    pub struct DeviceTransferResponse {
563        pub read_data: ::std::vec::Vec<::std::vec::Vec<u8>>,
564    }
565
566    unsafe impl<___E> ::fidl_next::Encode<crate::wire::DeviceTransferResponse<'static>, ___E>
567        for DeviceTransferResponse
568    where
569        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
570        ___E: ::fidl_next::Encoder,
571    {
572        #[inline]
573        fn encode(
574            self,
575            encoder_: &mut ___E,
576            out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceTransferResponse<'static>>,
577            _: (),
578        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
579            ::fidl_next::munge! {
580                let crate::wire::DeviceTransferResponse {
581                    read_data,
582
583                } = out_;
584            }
585
586            ::fidl_next::Encode::encode(self.read_data, encoder_, read_data, (256, (32768, ())))?;
587
588            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(read_data.as_mut_ptr()) };
589            ::fidl_next::Constrained::validate(_field, (256, (32768, ())))?;
590
591            Ok(())
592        }
593    }
594
595    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DeviceTransferResponse<'static>, ___E>
596        for &'a DeviceTransferResponse
597    where
598        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
599        ___E: ::fidl_next::Encoder,
600    {
601        #[inline]
602        fn encode(
603            self,
604            encoder_: &mut ___E,
605            out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceTransferResponse<'static>>,
606            _: (),
607        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
608            ::fidl_next::munge! {
609                let crate::wire::DeviceTransferResponse {
610
611                    read_data,
612
613                } = out_;
614            }
615
616            ::fidl_next::Encode::encode(&self.read_data, encoder_, read_data, (256, (32768, ())))?;
617
618            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(read_data.as_mut_ptr()) };
619            ::fidl_next::Constrained::validate(_field, (256, (32768, ())))?;
620
621            Ok(())
622        }
623    }
624
625    unsafe impl<___E>
626        ::fidl_next::EncodeOption<
627            ::fidl_next::wire::Box<'static, crate::wire::DeviceTransferResponse<'static>>,
628            ___E,
629        > for DeviceTransferResponse
630    where
631        ___E: ::fidl_next::Encoder + ?Sized,
632        DeviceTransferResponse:
633            ::fidl_next::Encode<crate::wire::DeviceTransferResponse<'static>, ___E>,
634    {
635        #[inline]
636        fn encode_option(
637            this: ::core::option::Option<Self>,
638            encoder: &mut ___E,
639            out: &mut ::core::mem::MaybeUninit<
640                ::fidl_next::wire::Box<'static, crate::wire::DeviceTransferResponse<'static>>,
641            >,
642            _: (),
643        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
644            if let Some(inner) = this {
645                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
646                ::fidl_next::wire::Box::encode_present(out);
647            } else {
648                ::fidl_next::wire::Box::encode_absent(out);
649            }
650
651            Ok(())
652        }
653    }
654
655    unsafe impl<'a, ___E>
656        ::fidl_next::EncodeOption<
657            ::fidl_next::wire::Box<'static, crate::wire::DeviceTransferResponse<'static>>,
658            ___E,
659        > for &'a DeviceTransferResponse
660    where
661        ___E: ::fidl_next::Encoder + ?Sized,
662        &'a DeviceTransferResponse:
663            ::fidl_next::Encode<crate::wire::DeviceTransferResponse<'static>, ___E>,
664    {
665        #[inline]
666        fn encode_option(
667            this: ::core::option::Option<Self>,
668            encoder: &mut ___E,
669            out: &mut ::core::mem::MaybeUninit<
670                ::fidl_next::wire::Box<'static, crate::wire::DeviceTransferResponse<'static>>,
671            >,
672            _: (),
673        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
674            if let Some(inner) = this {
675                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
676                ::fidl_next::wire::Box::encode_present(out);
677            } else {
678                ::fidl_next::wire::Box::encode_absent(out);
679            }
680
681            Ok(())
682        }
683    }
684
685    impl<'de> ::fidl_next::FromWire<crate::wire::DeviceTransferResponse<'de>>
686        for DeviceTransferResponse
687    {
688        #[inline]
689        fn from_wire(wire: crate::wire::DeviceTransferResponse<'de>) -> Self {
690            Self { read_data: ::fidl_next::FromWire::from_wire(wire.read_data) }
691        }
692    }
693
694    impl<'de> ::fidl_next::FromWireRef<crate::wire::DeviceTransferResponse<'de>>
695        for DeviceTransferResponse
696    {
697        #[inline]
698        fn from_wire_ref(wire: &crate::wire::DeviceTransferResponse<'de>) -> Self {
699            Self { read_data: ::fidl_next::FromWireRef::from_wire_ref(&wire.read_data) }
700        }
701    }
702
703    #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
704    pub struct DeviceGetNameResponse {
705        pub name: ::std::string::String,
706    }
707
708    unsafe impl<___E> ::fidl_next::Encode<crate::wire::DeviceGetNameResponse<'static>, ___E>
709        for DeviceGetNameResponse
710    where
711        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
712        ___E: ::fidl_next::Encoder,
713    {
714        #[inline]
715        fn encode(
716            self,
717            encoder_: &mut ___E,
718            out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetNameResponse<'static>>,
719            _: (),
720        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
721            ::fidl_next::munge! {
722                let crate::wire::DeviceGetNameResponse {
723                    name,
724
725                } = out_;
726            }
727
728            ::fidl_next::Encode::encode(self.name, encoder_, name, 64)?;
729
730            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(name.as_mut_ptr()) };
731            ::fidl_next::Constrained::validate(_field, 64)?;
732
733            Ok(())
734        }
735    }
736
737    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DeviceGetNameResponse<'static>, ___E>
738        for &'a DeviceGetNameResponse
739    where
740        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
741        ___E: ::fidl_next::Encoder,
742    {
743        #[inline]
744        fn encode(
745            self,
746            encoder_: &mut ___E,
747            out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetNameResponse<'static>>,
748            _: (),
749        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
750            ::fidl_next::munge! {
751                let crate::wire::DeviceGetNameResponse {
752
753                    name,
754
755                } = out_;
756            }
757
758            ::fidl_next::Encode::encode(&self.name, encoder_, name, 64)?;
759
760            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(name.as_mut_ptr()) };
761            ::fidl_next::Constrained::validate(_field, 64)?;
762
763            Ok(())
764        }
765    }
766
767    unsafe impl<___E>
768        ::fidl_next::EncodeOption<
769            ::fidl_next::wire::Box<'static, crate::wire::DeviceGetNameResponse<'static>>,
770            ___E,
771        > for DeviceGetNameResponse
772    where
773        ___E: ::fidl_next::Encoder + ?Sized,
774        DeviceGetNameResponse:
775            ::fidl_next::Encode<crate::wire::DeviceGetNameResponse<'static>, ___E>,
776    {
777        #[inline]
778        fn encode_option(
779            this: ::core::option::Option<Self>,
780            encoder: &mut ___E,
781            out: &mut ::core::mem::MaybeUninit<
782                ::fidl_next::wire::Box<'static, crate::wire::DeviceGetNameResponse<'static>>,
783            >,
784            _: (),
785        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
786            if let Some(inner) = this {
787                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
788                ::fidl_next::wire::Box::encode_present(out);
789            } else {
790                ::fidl_next::wire::Box::encode_absent(out);
791            }
792
793            Ok(())
794        }
795    }
796
797    unsafe impl<'a, ___E>
798        ::fidl_next::EncodeOption<
799            ::fidl_next::wire::Box<'static, crate::wire::DeviceGetNameResponse<'static>>,
800            ___E,
801        > for &'a DeviceGetNameResponse
802    where
803        ___E: ::fidl_next::Encoder + ?Sized,
804        &'a DeviceGetNameResponse:
805            ::fidl_next::Encode<crate::wire::DeviceGetNameResponse<'static>, ___E>,
806    {
807        #[inline]
808        fn encode_option(
809            this: ::core::option::Option<Self>,
810            encoder: &mut ___E,
811            out: &mut ::core::mem::MaybeUninit<
812                ::fidl_next::wire::Box<'static, crate::wire::DeviceGetNameResponse<'static>>,
813            >,
814            _: (),
815        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
816            if let Some(inner) = this {
817                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
818                ::fidl_next::wire::Box::encode_present(out);
819            } else {
820                ::fidl_next::wire::Box::encode_absent(out);
821            }
822
823            Ok(())
824        }
825    }
826
827    impl<'de> ::fidl_next::FromWire<crate::wire::DeviceGetNameResponse<'de>> for DeviceGetNameResponse {
828        #[inline]
829        fn from_wire(wire: crate::wire::DeviceGetNameResponse<'de>) -> Self {
830            Self { name: ::fidl_next::FromWire::from_wire(wire.name) }
831        }
832    }
833
834    impl<'de> ::fidl_next::FromWireRef<crate::wire::DeviceGetNameResponse<'de>>
835        for DeviceGetNameResponse
836    {
837        #[inline]
838        fn from_wire_ref(wire: &crate::wire::DeviceGetNameResponse<'de>) -> Self {
839            Self { name: ::fidl_next::FromWireRef::from_wire_ref(&wire.name) }
840        }
841    }
842}
843
844pub mod wire {
845
846    /// The wire type corresponding to [`DataTransfer`].
847    #[repr(transparent)]
848    pub struct DataTransfer<'de> {
849        pub(crate) raw: ::fidl_next::wire::Union,
850        pub(crate) _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
851    }
852
853    impl<'de> Drop for DataTransfer<'de> {
854        fn drop(&mut self) {
855            match self.raw.ordinal() {
856                1 => {
857                    let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::wire::Uint32>() };
858                }
859
860                2 => {
861                    let _ = unsafe {
862                        self.raw.get().read_unchecked::<::fidl_next::wire::Vector<'de, u8>>()
863                    };
864                }
865
866                _ => (),
867            }
868        }
869    }
870
871    impl ::fidl_next::Constrained for DataTransfer<'_> {
872        type Constraint = ();
873
874        fn validate(
875            _: ::fidl_next::Slot<'_, Self>,
876            _: Self::Constraint,
877        ) -> Result<(), ::fidl_next::ValidationError> {
878            Ok(())
879        }
880    }
881
882    unsafe impl ::fidl_next::Wire for DataTransfer<'static> {
883        type Narrowed<'de> = DataTransfer<'de>;
884
885        #[inline]
886        fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
887            ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
888            ::fidl_next::wire::Union::zero_padding(raw);
889        }
890    }
891
892    pub mod data_transfer {
893        pub enum Ref<'de> {
894            ReadSize(&'de ::fidl_next::wire::Uint32),
895
896            WriteData(&'de ::fidl_next::wire::Vector<'de, u8>),
897
898            UnknownOrdinal_(u64),
899        }
900    }
901
902    impl<'de> DataTransfer<'de> {
903        pub fn as_ref(&self) -> crate::wire::data_transfer::Ref<'_> {
904            match self.raw.ordinal() {
905                1 => crate::wire::data_transfer::Ref::ReadSize(unsafe {
906                    self.raw.get().deref_unchecked::<::fidl_next::wire::Uint32>()
907                }),
908
909                2 => crate::wire::data_transfer::Ref::WriteData(unsafe {
910                    self.raw.get().deref_unchecked::<::fidl_next::wire::Vector<'_, u8>>()
911                }),
912
913                unknown => crate::wire::data_transfer::Ref::UnknownOrdinal_(unknown),
914            }
915        }
916    }
917
918    unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for DataTransfer<'de>
919    where
920        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
921        ___D: ::fidl_next::Decoder<'de>,
922    {
923        fn decode(
924            mut slot: ::fidl_next::Slot<'_, Self>,
925            decoder: &mut ___D,
926            _: (),
927        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
928            ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
929            match ::fidl_next::wire::Union::encoded_ordinal(raw.as_mut()) {
930                1 => ::fidl_next::wire::Union::decode_as::<___D, ::fidl_next::wire::Uint32>(
931                    raw,
932                    decoder,
933                    (),
934                )?,
935
936                2 => {
937                    ::fidl_next::wire::Union::decode_as::<___D, ::fidl_next::wire::Vector<'de, u8>>(
938                        raw,
939                        decoder,
940                        (32768, ()),
941                    )?
942                }
943
944                _ => ::fidl_next::wire::Union::decode_unknown(raw, decoder)?,
945            }
946
947            Ok(())
948        }
949    }
950
951    impl<'de> ::core::fmt::Debug for DataTransfer<'de> {
952        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
953            match self.raw.ordinal() {
954                1 => unsafe {
955                    self.raw.get().deref_unchecked::<::fidl_next::wire::Uint32>().fmt(f)
956                },
957                2 => unsafe {
958                    self.raw.get().deref_unchecked::<::fidl_next::wire::Vector<'_, u8>>().fmt(f)
959                },
960                _ => unsafe { ::core::hint::unreachable_unchecked() },
961            }
962        }
963    }
964
965    impl<'de> ::fidl_next::IntoNatural for DataTransfer<'de> {
966        type Natural = crate::natural::DataTransfer;
967    }
968
969    /// The wire type corresponding to [`Transaction`].
970    #[repr(C)]
971    pub struct Transaction<'de> {
972        pub(crate) table: ::fidl_next::wire::Table<'de>,
973    }
974
975    impl<'de> Drop for Transaction<'de> {
976        fn drop(&mut self) {
977            let _ = self.table.get(1).map(|envelope| unsafe {
978                envelope.read_unchecked::<crate::wire::DataTransfer<'de>>()
979            });
980
981            let _ = self.table.get(2).map(|envelope| unsafe { envelope.read_unchecked::<bool>() });
982        }
983    }
984
985    impl ::fidl_next::Constrained for Transaction<'_> {
986        type Constraint = ();
987
988        fn validate(
989            _: ::fidl_next::Slot<'_, Self>,
990            _: Self::Constraint,
991        ) -> Result<(), ::fidl_next::ValidationError> {
992            Ok(())
993        }
994    }
995
996    unsafe impl ::fidl_next::Wire for Transaction<'static> {
997        type Narrowed<'de> = Transaction<'de>;
998
999        #[inline]
1000        fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
1001            ::fidl_next::munge!(let Self { table } = out);
1002            ::fidl_next::wire::Table::zero_padding(table);
1003        }
1004    }
1005
1006    unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for Transaction<'de>
1007    where
1008        ___D: ::fidl_next::Decoder<'de> + ?Sized,
1009    {
1010        fn decode(
1011            slot: ::fidl_next::Slot<'_, Self>,
1012            decoder: &mut ___D,
1013            _: (),
1014        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1015            ::fidl_next::munge!(let Self { table } = slot);
1016
1017            ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
1018                match ordinal {
1019                    0 => unsafe { ::core::hint::unreachable_unchecked() },
1020
1021                    1 => {
1022                        ::fidl_next::wire::Envelope::decode_as::<
1023                            ___D,
1024                            crate::wire::DataTransfer<'de>,
1025                        >(slot.as_mut(), decoder, ())?;
1026
1027                        Ok(())
1028                    }
1029
1030                    2 => {
1031                        ::fidl_next::wire::Envelope::decode_as::<___D, bool>(
1032                            slot.as_mut(),
1033                            decoder,
1034                            (),
1035                        )?;
1036
1037                        Ok(())
1038                    }
1039
1040                    _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
1041                }
1042            })
1043        }
1044    }
1045
1046    impl<'de> Transaction<'de> {
1047        pub fn data_transfer(&self) -> ::core::option::Option<&crate::wire::DataTransfer<'de>> {
1048            unsafe { Some(self.table.get(1)?.deref_unchecked()) }
1049        }
1050
1051        pub fn stop(&self) -> ::core::option::Option<&bool> {
1052            unsafe { Some(self.table.get(2)?.deref_unchecked()) }
1053        }
1054    }
1055
1056    impl<'de> ::core::fmt::Debug for Transaction<'de> {
1057        fn fmt(
1058            &self,
1059            f: &mut ::core::fmt::Formatter<'_>,
1060        ) -> ::core::result::Result<(), ::core::fmt::Error> {
1061            f.debug_struct("Transaction")
1062                .field("data_transfer", &self.data_transfer())
1063                .field("stop", &self.stop())
1064                .finish()
1065        }
1066    }
1067
1068    impl<'de> ::fidl_next::IntoNatural for Transaction<'de> {
1069        type Natural = crate::natural::Transaction;
1070    }
1071
1072    /// The wire type corresponding to [`DeviceTransferRequest`].
1073    #[derive(Debug)]
1074    #[repr(C)]
1075    pub struct DeviceTransferRequest<'de> {
1076        pub transactions: ::fidl_next::wire::Vector<'de, crate::wire::Transaction<'de>>,
1077    }
1078
1079    static_assertions::const_assert_eq!(std::mem::size_of::<DeviceTransferRequest<'_>>(), 16);
1080    static_assertions::const_assert_eq!(std::mem::align_of::<DeviceTransferRequest<'_>>(), 8);
1081
1082    static_assertions::const_assert_eq!(
1083        std::mem::offset_of!(DeviceTransferRequest<'_>, transactions),
1084        0
1085    );
1086
1087    impl ::fidl_next::Constrained for DeviceTransferRequest<'_> {
1088        type Constraint = ();
1089
1090        fn validate(
1091            _: ::fidl_next::Slot<'_, Self>,
1092            _: Self::Constraint,
1093        ) -> Result<(), ::fidl_next::ValidationError> {
1094            Ok(())
1095        }
1096    }
1097
1098    unsafe impl ::fidl_next::Wire for DeviceTransferRequest<'static> {
1099        type Narrowed<'de> = DeviceTransferRequest<'de>;
1100
1101        #[inline]
1102        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1103            ::fidl_next::munge! {
1104                let Self {
1105
1106                    transactions,
1107
1108                } = &mut *out_;
1109            }
1110
1111            ::fidl_next::Wire::zero_padding(transactions);
1112        }
1113    }
1114
1115    unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for DeviceTransferRequest<'de>
1116    where
1117        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1118        ___D: ::fidl_next::Decoder<'de>,
1119    {
1120        fn decode(
1121            slot_: ::fidl_next::Slot<'_, Self>,
1122            decoder_: &mut ___D,
1123            _: (),
1124        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1125            ::fidl_next::munge! {
1126                let Self {
1127
1128                    mut transactions,
1129
1130                } = slot_;
1131            }
1132
1133            let _field = transactions.as_mut();
1134            ::fidl_next::Constrained::validate(_field, (256, ()))?;
1135            ::fidl_next::Decode::decode(transactions.as_mut(), decoder_, (256, ()))?;
1136
1137            let transactions = unsafe { transactions.deref_unchecked() };
1138
1139            if transactions.len() > 256 {
1140                return Err(::fidl_next::DecodeError::VectorTooLong {
1141                    size: transactions.len() as u64,
1142                    limit: 256,
1143                });
1144            }
1145
1146            Ok(())
1147        }
1148    }
1149
1150    impl<'de> ::fidl_next::IntoNatural for DeviceTransferRequest<'de> {
1151        type Natural = crate::natural::DeviceTransferRequest;
1152    }
1153
1154    /// The wire type corresponding to [`ReadData`](crate::natural::ReadData).
1155    pub type ReadData<'de> = ::fidl_next::wire::Vector<'de, u8>;
1156
1157    /// The wire type corresponding to [`DeviceTransferResponse`].
1158    #[derive(Debug)]
1159    #[repr(C)]
1160    pub struct DeviceTransferResponse<'de> {
1161        pub read_data: ::fidl_next::wire::Vector<'de, ::fidl_next::wire::Vector<'de, u8>>,
1162    }
1163
1164    static_assertions::const_assert_eq!(std::mem::size_of::<DeviceTransferResponse<'_>>(), 16);
1165    static_assertions::const_assert_eq!(std::mem::align_of::<DeviceTransferResponse<'_>>(), 8);
1166
1167    static_assertions::const_assert_eq!(
1168        std::mem::offset_of!(DeviceTransferResponse<'_>, read_data),
1169        0
1170    );
1171
1172    impl ::fidl_next::Constrained for DeviceTransferResponse<'_> {
1173        type Constraint = ();
1174
1175        fn validate(
1176            _: ::fidl_next::Slot<'_, Self>,
1177            _: Self::Constraint,
1178        ) -> Result<(), ::fidl_next::ValidationError> {
1179            Ok(())
1180        }
1181    }
1182
1183    unsafe impl ::fidl_next::Wire for DeviceTransferResponse<'static> {
1184        type Narrowed<'de> = DeviceTransferResponse<'de>;
1185
1186        #[inline]
1187        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1188            ::fidl_next::munge! {
1189                let Self {
1190
1191                    read_data,
1192
1193                } = &mut *out_;
1194            }
1195
1196            ::fidl_next::Wire::zero_padding(read_data);
1197        }
1198    }
1199
1200    unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for DeviceTransferResponse<'de>
1201    where
1202        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1203        ___D: ::fidl_next::Decoder<'de>,
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
1213                    mut read_data,
1214
1215                } = slot_;
1216            }
1217
1218            let _field = read_data.as_mut();
1219            ::fidl_next::Constrained::validate(_field, (256, (32768, ())))?;
1220            ::fidl_next::Decode::decode(read_data.as_mut(), decoder_, (256, (32768, ())))?;
1221
1222            let read_data = unsafe { read_data.deref_unchecked() };
1223
1224            if read_data.len() > 256 {
1225                return Err(::fidl_next::DecodeError::VectorTooLong {
1226                    size: read_data.len() as u64,
1227                    limit: 256,
1228                });
1229            }
1230
1231            Ok(())
1232        }
1233    }
1234
1235    impl<'de> ::fidl_next::IntoNatural for DeviceTransferResponse<'de> {
1236        type Natural = crate::natural::DeviceTransferResponse;
1237    }
1238
1239    /// The wire type corresponding to [`DeviceGetNameResponse`].
1240    #[derive(Debug)]
1241    #[repr(C)]
1242    pub struct DeviceGetNameResponse<'de> {
1243        pub name: ::fidl_next::wire::String<'de>,
1244    }
1245
1246    static_assertions::const_assert_eq!(std::mem::size_of::<DeviceGetNameResponse<'_>>(), 16);
1247    static_assertions::const_assert_eq!(std::mem::align_of::<DeviceGetNameResponse<'_>>(), 8);
1248
1249    static_assertions::const_assert_eq!(std::mem::offset_of!(DeviceGetNameResponse<'_>, name), 0);
1250
1251    impl ::fidl_next::Constrained for DeviceGetNameResponse<'_> {
1252        type Constraint = ();
1253
1254        fn validate(
1255            _: ::fidl_next::Slot<'_, Self>,
1256            _: Self::Constraint,
1257        ) -> Result<(), ::fidl_next::ValidationError> {
1258            Ok(())
1259        }
1260    }
1261
1262    unsafe impl ::fidl_next::Wire for DeviceGetNameResponse<'static> {
1263        type Narrowed<'de> = DeviceGetNameResponse<'de>;
1264
1265        #[inline]
1266        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1267            ::fidl_next::munge! {
1268                let Self {
1269
1270                    name,
1271
1272                } = &mut *out_;
1273            }
1274
1275            ::fidl_next::Wire::zero_padding(name);
1276        }
1277    }
1278
1279    unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for DeviceGetNameResponse<'de>
1280    where
1281        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1282        ___D: ::fidl_next::Decoder<'de>,
1283    {
1284        fn decode(
1285            slot_: ::fidl_next::Slot<'_, Self>,
1286            decoder_: &mut ___D,
1287            _: (),
1288        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1289            ::fidl_next::munge! {
1290                let Self {
1291
1292                    mut name,
1293
1294                } = slot_;
1295            }
1296
1297            let _field = name.as_mut();
1298            ::fidl_next::Constrained::validate(_field, 64)?;
1299            ::fidl_next::Decode::decode(name.as_mut(), decoder_, 64)?;
1300
1301            let name = unsafe { name.deref_unchecked() };
1302
1303            if name.len() > 64 {
1304                return Err(::fidl_next::DecodeError::VectorTooLong {
1305                    size: name.len() as u64,
1306                    limit: 64,
1307                });
1308            }
1309
1310            Ok(())
1311        }
1312    }
1313
1314    impl<'de> ::fidl_next::IntoNatural for DeviceGetNameResponse<'de> {
1315        type Natural = crate::natural::DeviceGetNameResponse;
1316    }
1317}
1318
1319pub mod wire_optional {
1320
1321    #[repr(transparent)]
1322    pub struct DataTransfer<'de> {
1323        pub(crate) raw: ::fidl_next::wire::Union,
1324        pub(crate) _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
1325    }
1326
1327    impl ::fidl_next::Constrained for DataTransfer<'_> {
1328        type Constraint = ();
1329
1330        fn validate(
1331            _: ::fidl_next::Slot<'_, Self>,
1332            _: Self::Constraint,
1333        ) -> Result<(), ::fidl_next::ValidationError> {
1334            Ok(())
1335        }
1336    }
1337
1338    unsafe impl ::fidl_next::Wire for DataTransfer<'static> {
1339        type Narrowed<'de> = DataTransfer<'de>;
1340
1341        #[inline]
1342        fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
1343            ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
1344            ::fidl_next::wire::Union::zero_padding(raw);
1345        }
1346    }
1347
1348    impl<'de> DataTransfer<'de> {
1349        pub fn is_some(&self) -> bool {
1350            self.raw.is_some()
1351        }
1352
1353        pub fn is_none(&self) -> bool {
1354            self.raw.is_none()
1355        }
1356
1357        pub fn as_ref(&self) -> ::core::option::Option<&crate::wire::DataTransfer<'de>> {
1358            if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None }
1359        }
1360
1361        pub fn into_option(self) -> ::core::option::Option<crate::wire::DataTransfer<'de>> {
1362            if self.is_some() {
1363                Some(crate::wire::DataTransfer {
1364                    raw: self.raw,
1365                    _phantom: ::core::marker::PhantomData,
1366                })
1367            } else {
1368                None
1369            }
1370        }
1371    }
1372
1373    unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for DataTransfer<'de>
1374    where
1375        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1376        ___D: ::fidl_next::Decoder<'de>,
1377    {
1378        fn decode(
1379            mut slot: ::fidl_next::Slot<'_, Self>,
1380            decoder: &mut ___D,
1381            _: (),
1382        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1383            ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
1384            match ::fidl_next::wire::Union::encoded_ordinal(raw.as_mut()) {
1385                1 => ::fidl_next::wire::Union::decode_as::<___D, ::fidl_next::wire::Uint32>(
1386                    raw,
1387                    decoder,
1388                    (),
1389                )?,
1390
1391                2 => {
1392                    ::fidl_next::wire::Union::decode_as::<___D, ::fidl_next::wire::Vector<'de, u8>>(
1393                        raw,
1394                        decoder,
1395                        (32768, ()),
1396                    )?
1397                }
1398
1399                0 => ::fidl_next::wire::Union::decode_absent(raw)?,
1400                _ => ::fidl_next::wire::Union::decode_unknown(raw, decoder)?,
1401            }
1402
1403            Ok(())
1404        }
1405    }
1406
1407    impl<'de> ::core::fmt::Debug for DataTransfer<'de> {
1408        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1409            self.as_ref().fmt(f)
1410        }
1411    }
1412
1413    impl<'de> ::fidl_next::IntoNatural for DataTransfer<'de> {
1414        type Natural = ::core::option::Option<crate::natural::DataTransfer>;
1415    }
1416}
1417
1418pub mod generic {
1419
1420    pub struct DeviceTransferRequest<T0> {
1421        pub transactions: T0,
1422    }
1423
1424    unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceTransferRequest<'static>, ___E>
1425        for DeviceTransferRequest<T0>
1426    where
1427        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1428        ___E: ::fidl_next::Encoder,
1429        T0: ::fidl_next::Encode<
1430                ::fidl_next::wire::Vector<'static, crate::wire::Transaction<'static>>,
1431                ___E,
1432            >,
1433    {
1434        #[inline]
1435        fn encode(
1436            self,
1437            encoder_: &mut ___E,
1438            out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceTransferRequest<'static>>,
1439            _: (),
1440        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1441            ::fidl_next::munge! {
1442                let crate::wire::DeviceTransferRequest {
1443
1444                    transactions,
1445
1446                } = out_;
1447            }
1448
1449            ::fidl_next::Encode::encode(self.transactions, encoder_, transactions, (256, ()))?;
1450
1451            Ok(())
1452        }
1453    }
1454
1455    pub struct DeviceTransferResponse<T0> {
1456        pub read_data: T0,
1457    }
1458
1459    unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceTransferResponse<'static>, ___E>
1460        for DeviceTransferResponse<T0>
1461    where
1462        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1463        ___E: ::fidl_next::Encoder,
1464        T0: ::fidl_next::Encode<
1465                ::fidl_next::wire::Vector<'static, ::fidl_next::wire::Vector<'static, u8>>,
1466                ___E,
1467            >,
1468    {
1469        #[inline]
1470        fn encode(
1471            self,
1472            encoder_: &mut ___E,
1473            out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceTransferResponse<'static>>,
1474            _: (),
1475        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1476            ::fidl_next::munge! {
1477                let crate::wire::DeviceTransferResponse {
1478
1479                    read_data,
1480
1481                } = out_;
1482            }
1483
1484            ::fidl_next::Encode::encode(self.read_data, encoder_, read_data, (256, (32768, ())))?;
1485
1486            Ok(())
1487        }
1488    }
1489
1490    pub struct DeviceGetNameResponse<T0> {
1491        pub name: T0,
1492    }
1493
1494    unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceGetNameResponse<'static>, ___E>
1495        for DeviceGetNameResponse<T0>
1496    where
1497        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1498        ___E: ::fidl_next::Encoder,
1499        T0: ::fidl_next::Encode<::fidl_next::wire::String<'static>, ___E>,
1500    {
1501        #[inline]
1502        fn encode(
1503            self,
1504            encoder_: &mut ___E,
1505            out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetNameResponse<'static>>,
1506            _: (),
1507        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1508            ::fidl_next::munge! {
1509                let crate::wire::DeviceGetNameResponse {
1510
1511                    name,
1512
1513                } = out_;
1514            }
1515
1516            ::fidl_next::Encode::encode(self.name, encoder_, name, 64)?;
1517
1518            Ok(())
1519        }
1520    }
1521}
1522
1523pub use self::natural::*;
1524
1525#[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"]
1526pub const MAX_TRANSFER_SIZE: u32 = 32768 as u32;
1527
1528#[doc = " The maximum number of transactions that can be specified in a call to `Transfer`.\n"]
1529pub const MAX_COUNT_TRANSACTIONS: u32 = 256 as u32;
1530
1531#[doc = " Maximum length of the I2C Channel name.\n"]
1532pub const MAX_I2_C_NAME_LEN: u32 = 64 as u32;
1533
1534/// The type corresponding to the Device protocol.
1535#[derive(PartialEq, Debug)]
1536pub struct Device;
1537
1538impl ::fidl_next::Discoverable for Device {
1539    const PROTOCOL_NAME: &'static str = "fuchsia.hardware.i2c.Device";
1540}
1541
1542#[cfg(target_os = "fuchsia")]
1543impl ::fidl_next::HasTransport for Device {
1544    type Transport = ::fidl_next::fuchsia::zx::Channel;
1545}
1546
1547pub mod device {
1548    pub mod prelude {
1549        pub use crate::{Device, DeviceClientHandler, DeviceServerHandler, device};
1550
1551        pub use crate::natural::DeviceTransferRequest;
1552
1553        pub use crate::natural::DeviceGetNameResponse;
1554
1555        pub use crate::natural::DeviceTransferResponse;
1556    }
1557
1558    pub struct Transfer;
1559
1560    impl ::fidl_next::Method for Transfer {
1561        const ORDINAL: u64 = 871058866166117179;
1562        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1563            ::fidl_next::protocol::Flexibility::Strict;
1564
1565        type Protocol = crate::Device;
1566
1567        type Request = crate::wire::DeviceTransferRequest<'static>;
1568    }
1569
1570    impl ::fidl_next::TwoWayMethod for Transfer {
1571        type Response = ::fidl_next::wire::Result<
1572            'static,
1573            crate::wire::DeviceTransferResponse<'static>,
1574            ::fidl_next::wire::Int32,
1575        >;
1576    }
1577
1578    impl<___R> ::fidl_next::Respond<___R> for Transfer {
1579        type Output = ::core::result::Result<
1580            crate::generic::DeviceTransferResponse<___R>,
1581            ::fidl_next::util::Never,
1582        >;
1583
1584        fn respond(response: ___R) -> Self::Output {
1585            ::core::result::Result::Ok(crate::generic::DeviceTransferResponse {
1586                read_data: response,
1587            })
1588        }
1589    }
1590
1591    impl<___R> ::fidl_next::RespondErr<___R> for Transfer {
1592        type Output = ::core::result::Result<::fidl_next::util::Never, ___R>;
1593
1594        fn respond_err(response: ___R) -> Self::Output {
1595            ::core::result::Result::Err(response)
1596        }
1597    }
1598
1599    pub struct GetName;
1600
1601    impl ::fidl_next::Method for GetName {
1602        const ORDINAL: u64 = 8381876914474840322;
1603        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1604            ::fidl_next::protocol::Flexibility::Strict;
1605
1606        type Protocol = crate::Device;
1607
1608        type Request = ();
1609    }
1610
1611    impl ::fidl_next::TwoWayMethod for GetName {
1612        type Response = ::fidl_next::wire::Result<
1613            'static,
1614            crate::wire::DeviceGetNameResponse<'static>,
1615            ::fidl_next::wire::Int32,
1616        >;
1617    }
1618
1619    impl<___R> ::fidl_next::Respond<___R> for GetName {
1620        type Output = ::core::result::Result<
1621            crate::generic::DeviceGetNameResponse<___R>,
1622            ::fidl_next::util::Never,
1623        >;
1624
1625        fn respond(response: ___R) -> Self::Output {
1626            ::core::result::Result::Ok(crate::generic::DeviceGetNameResponse { name: response })
1627        }
1628    }
1629
1630    impl<___R> ::fidl_next::RespondErr<___R> for GetName {
1631        type Output = ::core::result::Result<::fidl_next::util::Never, ___R>;
1632
1633        fn respond_err(response: ___R) -> Self::Output {
1634            ::core::result::Result::Err(response)
1635        }
1636    }
1637
1638    mod ___detail {
1639        unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Device
1640        where
1641            ___T: ::fidl_next::Transport,
1642        {
1643            type Client = DeviceClient<___T>;
1644            type Server = DeviceServer<___T>;
1645        }
1646
1647        /// The client for the `Device` protocol.
1648        #[repr(transparent)]
1649        pub struct DeviceClient<___T: ::fidl_next::Transport> {
1650            #[allow(dead_code)]
1651            client: ::fidl_next::protocol::Client<___T>,
1652        }
1653
1654        impl<___T> DeviceClient<___T>
1655        where
1656            ___T: ::fidl_next::Transport,
1657        {
1658            #[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"]
1659            pub fn transfer(
1660                &self,
1661
1662                transactions: impl ::fidl_next::Encode<
1663                    ::fidl_next::wire::Vector<'static, crate::wire::Transaction<'static>>,
1664                    <___T as ::fidl_next::Transport>::SendBuffer,
1665                >,
1666            ) -> ::fidl_next::TwoWayFuture<'_, super::Transfer, ___T>
1667            where
1668                <___T as ::fidl_next::Transport>::SendBuffer:
1669                    ::fidl_next::encoder::InternalHandleEncoder,
1670                <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
1671            {
1672                self.transfer_with(crate::generic::DeviceTransferRequest { transactions })
1673            }
1674
1675            #[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"]
1676            pub fn transfer_with<___R>(
1677                &self,
1678                request: ___R,
1679            ) -> ::fidl_next::TwoWayFuture<'_, super::Transfer, ___T>
1680            where
1681                ___R: ::fidl_next::Encode<
1682                        crate::wire::DeviceTransferRequest<'static>,
1683                        <___T as ::fidl_next::Transport>::SendBuffer,
1684                    >,
1685            {
1686                ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1687                    871058866166117179,
1688                    <super::Transfer as ::fidl_next::Method>::FLEXIBILITY,
1689                    request,
1690                ))
1691            }
1692
1693            #[doc = " Get the name of this I2C Device. Returns ZX_ERR_NOT_SUPPORTED if the\n name is unspecified or the empty string.\n"]
1694            pub fn get_name(&self) -> ::fidl_next::TwoWayFuture<'_, super::GetName, ___T> {
1695                ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1696                    8381876914474840322,
1697                    <super::GetName as ::fidl_next::Method>::FLEXIBILITY,
1698                    (),
1699                ))
1700            }
1701        }
1702
1703        /// The server for the `Device` protocol.
1704        #[repr(transparent)]
1705        pub struct DeviceServer<___T: ::fidl_next::Transport> {
1706            server: ::fidl_next::protocol::Server<___T>,
1707        }
1708
1709        impl<___T> DeviceServer<___T> where ___T: ::fidl_next::Transport {}
1710    }
1711}
1712
1713/// A client handler for the Device protocol.
1714///
1715/// See [`Device`] for more details.
1716pub trait DeviceClientHandler<
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<___T> DeviceClientHandler<___T> for ::fidl_next::IgnoreEvents where ___T: ::fidl_next::Transport
1724{}
1725
1726impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Device
1727where
1728    ___H: DeviceClientHandler<___T> + ::core::marker::Send,
1729    ___T: ::fidl_next::Transport,
1730{
1731    async fn on_event(
1732        handler: &mut ___H,
1733        ordinal: u64,
1734        flexibility: ::fidl_next::protocol::Flexibility,
1735        body: ::fidl_next::Body<___T>,
1736    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1737        match ordinal {
1738            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
1739        }
1740    }
1741}
1742
1743/// A server handler for the Device protocol.
1744///
1745/// See [`Device`] for more details.
1746pub trait DeviceServerHandler<
1747    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1748    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1749>
1750{
1751    #[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"]
1752    fn transfer(
1753        &mut self,
1754
1755        request: ::fidl_next::Request<device::Transfer, ___T>,
1756
1757        responder: ::fidl_next::Responder<device::Transfer, ___T>,
1758    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1759
1760    #[doc = " Get the name of this I2C Device. Returns ZX_ERR_NOT_SUPPORTED if the\n name is unspecified or the empty string.\n"]
1761    fn get_name(
1762        &mut self,
1763
1764        responder: ::fidl_next::Responder<device::GetName, ___T>,
1765    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1766}
1767
1768impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Device
1769where
1770    ___H: DeviceServerHandler<___T> + ::core::marker::Send,
1771    ___T: ::fidl_next::Transport,
1772    for<'de> crate::wire::DeviceTransferRequest<'de>: ::fidl_next::Decode<
1773            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1774            Constraint = (),
1775        >,
1776{
1777    async fn on_one_way(
1778        handler: &mut ___H,
1779        ordinal: u64,
1780        flexibility: ::fidl_next::protocol::Flexibility,
1781        body: ::fidl_next::Body<___T>,
1782    ) -> ::core::result::Result<
1783        (),
1784        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1785    > {
1786        match ordinal {
1787            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
1788        }
1789    }
1790
1791    async fn on_two_way(
1792        handler: &mut ___H,
1793        ordinal: u64,
1794        flexibility: ::fidl_next::protocol::Flexibility,
1795        body: ::fidl_next::Body<___T>,
1796        responder: ::fidl_next::protocol::Responder<___T>,
1797    ) -> ::core::result::Result<
1798        (),
1799        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1800    > {
1801        match ordinal {
1802            871058866166117179 => {
1803                let responder = ::fidl_next::Responder::from_untyped(responder);
1804
1805                match ::fidl_next::AsDecoderExt::into_decoded(body) {
1806                    Ok(decoded) => {
1807                        handler
1808                            .transfer(::fidl_next::Request::from_decoded(decoded), responder)
1809                            .await;
1810                        Ok(())
1811                    }
1812                    Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1813                        ordinal: 871058866166117179,
1814                        error,
1815                    }),
1816                }
1817            }
1818
1819            8381876914474840322 => {
1820                let responder = ::fidl_next::Responder::from_untyped(responder);
1821
1822                handler.get_name(responder).await;
1823                Ok(())
1824            }
1825
1826            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
1827        }
1828    }
1829}
1830
1831/// Compatibility shims which mimic some API surfaces of the current Rust bindings.
1832pub mod compat {
1833
1834    impl ::fidl_next::CompatFrom<crate::DataTransfer> for ::fidl_fuchsia_hardware_i2c::DataTransfer {
1835        fn compat_from(value: crate::DataTransfer) -> Self {
1836            match value {
1837                crate::DataTransfer::ReadSize(value) => {
1838                    Self::ReadSize(::fidl_next::CompatFrom::compat_from(value))
1839                }
1840
1841                crate::DataTransfer::WriteData(value) => {
1842                    Self::WriteData(::fidl_next::CompatFrom::compat_from(value))
1843                }
1844
1845                crate::DataTransfer::UnknownOrdinal_(unknown_ordinal) => {
1846                    Self::__SourceBreaking { unknown_ordinal }
1847                }
1848            }
1849        }
1850    }
1851
1852    impl ::fidl_next::CompatFrom<::fidl_fuchsia_hardware_i2c::DataTransfer> for crate::DataTransfer {
1853        fn compat_from(value: ::fidl_fuchsia_hardware_i2c::DataTransfer) -> Self {
1854            match value {
1855                ::fidl_fuchsia_hardware_i2c::DataTransfer::ReadSize(value) => {
1856                    Self::ReadSize(::fidl_next::CompatFrom::compat_from(value))
1857                }
1858
1859                ::fidl_fuchsia_hardware_i2c::DataTransfer::WriteData(value) => {
1860                    Self::WriteData(::fidl_next::CompatFrom::compat_from(value))
1861                }
1862
1863                ::fidl_fuchsia_hardware_i2c::DataTransfer::__SourceBreaking { unknown_ordinal } => {
1864                    Self::UnknownOrdinal_(unknown_ordinal)
1865                }
1866            }
1867        }
1868    }
1869
1870    impl ::fidl_next::CompatFrom<crate::Transaction> for ::fidl_fuchsia_hardware_i2c::Transaction {
1871        fn compat_from(value: crate::Transaction) -> Self {
1872            Self {
1873                data_transfer: ::fidl_next::CompatFrom::compat_from(value.data_transfer),
1874
1875                stop: ::fidl_next::CompatFrom::compat_from(value.stop),
1876
1877                __source_breaking: ::fidl::marker::SourceBreaking,
1878            }
1879        }
1880    }
1881
1882    impl ::fidl_next::CompatFrom<::fidl_fuchsia_hardware_i2c::Transaction> for crate::Transaction {
1883        fn compat_from(value: ::fidl_fuchsia_hardware_i2c::Transaction) -> Self {
1884            Self {
1885                data_transfer: ::fidl_next::CompatFrom::compat_from(value.data_transfer),
1886
1887                stop: ::fidl_next::CompatFrom::compat_from(value.stop),
1888            }
1889        }
1890    }
1891
1892    impl ::fidl_next::CompatFrom<crate::DeviceTransferRequest>
1893        for ::fidl_fuchsia_hardware_i2c::DeviceTransferRequest
1894    {
1895        #[inline]
1896        fn compat_from(value: crate::DeviceTransferRequest) -> Self {
1897            Self { transactions: ::fidl_next::CompatFrom::compat_from(value.transactions) }
1898        }
1899    }
1900
1901    impl ::fidl_next::CompatFrom<::fidl_fuchsia_hardware_i2c::DeviceTransferRequest>
1902        for crate::DeviceTransferRequest
1903    {
1904        #[inline]
1905        fn compat_from(value: ::fidl_fuchsia_hardware_i2c::DeviceTransferRequest) -> Self {
1906            Self { transactions: ::fidl_next::CompatFrom::compat_from(value.transactions) }
1907        }
1908    }
1909
1910    impl ::fidl_next::CompatFrom<crate::DeviceTransferResponse>
1911        for ::fidl_fuchsia_hardware_i2c::DeviceTransferResponse
1912    {
1913        #[inline]
1914        fn compat_from(value: crate::DeviceTransferResponse) -> Self {
1915            Self { read_data: ::fidl_next::CompatFrom::compat_from(value.read_data) }
1916        }
1917    }
1918
1919    impl ::fidl_next::CompatFrom<::fidl_fuchsia_hardware_i2c::DeviceTransferResponse>
1920        for crate::DeviceTransferResponse
1921    {
1922        #[inline]
1923        fn compat_from(value: ::fidl_fuchsia_hardware_i2c::DeviceTransferResponse) -> Self {
1924            Self { read_data: ::fidl_next::CompatFrom::compat_from(value.read_data) }
1925        }
1926    }
1927
1928    impl ::fidl_next::CompatFrom<crate::DeviceGetNameResponse>
1929        for ::fidl_fuchsia_hardware_i2c::DeviceGetNameResponse
1930    {
1931        #[inline]
1932        fn compat_from(value: crate::DeviceGetNameResponse) -> Self {
1933            Self { name: ::fidl_next::CompatFrom::compat_from(value.name) }
1934        }
1935    }
1936
1937    impl ::fidl_next::CompatFrom<::fidl_fuchsia_hardware_i2c::DeviceGetNameResponse>
1938        for crate::DeviceGetNameResponse
1939    {
1940        #[inline]
1941        fn compat_from(value: ::fidl_fuchsia_hardware_i2c::DeviceGetNameResponse) -> Self {
1942            Self { name: ::fidl_next::CompatFrom::compat_from(value.name) }
1943        }
1944    }
1945
1946    #[cfg(target_os = "fuchsia")]
1947    /// An alias for a client over `zx::Channel` for the `Device`
1948    /// protocol.
1949    pub type DeviceProxy = ::fidl_next::Client<crate::Device>;
1950
1951    impl ::fidl_next::CompatFrom<crate::Device> for ::fidl_fuchsia_hardware_i2c::DeviceMarker {
1952        fn compat_from(_: crate::Device) -> Self {
1953            Self
1954        }
1955    }
1956
1957    impl ::fidl_next::CompatFrom<::fidl_fuchsia_hardware_i2c::DeviceMarker> for crate::Device {
1958        fn compat_from(_: ::fidl_fuchsia_hardware_i2c::DeviceMarker) -> Self {
1959            Self
1960        }
1961    }
1962
1963    #[cfg(target_os = "fuchsia")]
1964
1965    impl ::fidl_next::ClientCompatFrom<::fidl_fuchsia_hardware_i2c::DeviceProxy> for crate::Device {
1966        fn client_compat_from(
1967            proxy: ::fidl_fuchsia_hardware_i2c::DeviceProxy,
1968        ) -> ::fidl_next::ClientDispatcher<Self, ::fidl_next::fuchsia::zx::Channel> {
1969            let channel = ::fidl::endpoints::Proxy::into_channel(proxy).unwrap().into_zx_channel();
1970            let client_end = ::fidl_next::ClientEnd::from_untyped(channel);
1971            ::fidl_next::ClientDispatcher::new(client_end)
1972        }
1973    }
1974}