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::RawWireUnion::encode_as::<
43                    ___E,
44                    ::fidl_next::WireU32,
45                >(value, 1, encoder, raw, ())?,
46
47                Self::WriteData(value) => ::fidl_next::RawWireUnion::encode_as::<
48                    ___E,
49                    ::fidl_next::WireVector<'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::RawWireUnion::encode_as::<
78                    ___E,
79                    ::fidl_next::WireU32,
80                >(value, 1, encoder, raw, ())?,
81
82                DataTransfer::WriteData(value) => {
83                    ::fidl_next::RawWireUnion::encode_as::<
84                        ___E,
85                        ::fidl_next::WireVector<'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::RawWireUnion::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::RawWireUnion::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::WireU32>()
158                })),
159
160                2 => Self::WriteData(::fidl_next::FromWire::from_wire(unsafe {
161                    wire.raw.get().read_unchecked::<::fidl_next::WireVector<'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::WireU32>()
175                })),
176
177                2 => Self::WriteData(::fidl_next::FromWireRef::from_wire_ref(unsafe {
178                    wire.raw.get().deref_unchecked::<::fidl_next::WireVector<'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::WireEnvelope>::uninit();
265            ::fidl_next::Wire::zero_padding(&mut out);
266
267            let mut preallocated =
268                ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
269
270            for i in 1..=max_ord {
271                match i {
272                    2 => {
273                        if let Some(value) = self.stop.take() {
274                            ::fidl_next::WireEnvelope::encode_value::<bool, ___E>(
275                                value,
276                                preallocated.encoder,
277                                &mut out,
278                                (),
279                            )?;
280                        } else {
281                            ::fidl_next::WireEnvelope::encode_zero(&mut out)
282                        }
283                    }
284
285                    1 => {
286                        if let Some(value) = self.data_transfer.take() {
287                            ::fidl_next::WireEnvelope::encode_value::<
288                                crate::wire::DataTransfer<'static>,
289                                ___E,
290                            >(
291                                value, preallocated.encoder, &mut out, ()
292                            )?;
293                        } else {
294                            ::fidl_next::WireEnvelope::encode_zero(&mut out)
295                        }
296                    }
297
298                    _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
299                }
300                unsafe {
301                    preallocated.write_next(out.assume_init_ref());
302                }
303            }
304
305            ::fidl_next::WireTable::encode_len(table, max_ord);
306
307            Ok(())
308        }
309    }
310
311    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::Transaction<'static>, ___E>
312        for &'a Transaction
313    where
314        ___E: ::fidl_next::Encoder + ?Sized,
315    {
316        #[inline]
317        fn encode(
318            self,
319            encoder: &mut ___E,
320            out: &mut ::core::mem::MaybeUninit<crate::wire::Transaction<'static>>,
321            _: (),
322        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
323            ::fidl_next::munge!(let crate::wire::Transaction { table } = out);
324
325            let max_ord = self.__max_ordinal();
326
327            let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
328            ::fidl_next::Wire::zero_padding(&mut out);
329
330            let mut preallocated =
331                ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
332
333            for i in 1..=max_ord {
334                match i {
335                    2 => {
336                        if let Some(value) = &self.stop {
337                            ::fidl_next::WireEnvelope::encode_value::<bool, ___E>(
338                                value,
339                                preallocated.encoder,
340                                &mut out,
341                                (),
342                            )?;
343                        } else {
344                            ::fidl_next::WireEnvelope::encode_zero(&mut out)
345                        }
346                    }
347
348                    1 => {
349                        if let Some(value) = &self.data_transfer {
350                            ::fidl_next::WireEnvelope::encode_value::<
351                                crate::wire::DataTransfer<'static>,
352                                ___E,
353                            >(
354                                value, preallocated.encoder, &mut out, ()
355                            )?;
356                        } else {
357                            ::fidl_next::WireEnvelope::encode_zero(&mut out)
358                        }
359                    }
360
361                    _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
362                }
363                unsafe {
364                    preallocated.write_next(out.assume_init_ref());
365                }
366            }
367
368            ::fidl_next::WireTable::encode_len(table, max_ord);
369
370            Ok(())
371        }
372    }
373
374    impl<'de> ::fidl_next::FromWire<crate::wire::Transaction<'de>> for Transaction {
375        #[inline]
376        fn from_wire(wire_: crate::wire::Transaction<'de>) -> Self {
377            let wire_ = ::core::mem::ManuallyDrop::new(wire_);
378
379            let data_transfer = wire_.table.get(1);
380
381            let stop = wire_.table.get(2);
382
383            Self {
384                data_transfer: data_transfer.map(|envelope| {
385                    ::fidl_next::FromWire::from_wire(unsafe {
386                        envelope.read_unchecked::<crate::wire::DataTransfer<'de>>()
387                    })
388                }),
389
390                stop: stop.map(|envelope| {
391                    ::fidl_next::FromWire::from_wire(unsafe { envelope.read_unchecked::<bool>() })
392                }),
393            }
394        }
395    }
396
397    impl<'de> ::fidl_next::FromWireRef<crate::wire::Transaction<'de>> for Transaction {
398        #[inline]
399        fn from_wire_ref(wire: &crate::wire::Transaction<'de>) -> Self {
400            Self {
401                data_transfer: wire.table.get(1).map(|envelope| {
402                    ::fidl_next::FromWireRef::from_wire_ref(unsafe {
403                        envelope.deref_unchecked::<crate::wire::DataTransfer<'de>>()
404                    })
405                }),
406
407                stop: wire.table.get(2).map(|envelope| {
408                    ::fidl_next::FromWireRef::from_wire_ref(unsafe {
409                        envelope.deref_unchecked::<bool>()
410                    })
411                }),
412            }
413        }
414    }
415
416    #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
417    pub struct DeviceTransferRequest {
418        pub transactions: ::std::vec::Vec<crate::natural::Transaction>,
419    }
420
421    unsafe impl<___E> ::fidl_next::Encode<crate::wire::DeviceTransferRequest<'static>, ___E>
422        for DeviceTransferRequest
423    where
424        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
425        ___E: ::fidl_next::Encoder,
426    {
427        #[inline]
428        fn encode(
429            self,
430            encoder_: &mut ___E,
431            out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceTransferRequest<'static>>,
432            _: (),
433        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
434            ::fidl_next::munge! {
435                let crate::wire::DeviceTransferRequest {
436                    transactions,
437
438                } = out_;
439            }
440
441            ::fidl_next::Encode::encode(self.transactions, encoder_, transactions, (256, ()))?;
442
443            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(transactions.as_mut_ptr()) };
444            ::fidl_next::Constrained::validate(_field, (256, ()))?;
445
446            Ok(())
447        }
448    }
449
450    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DeviceTransferRequest<'static>, ___E>
451        for &'a DeviceTransferRequest
452    where
453        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
454        ___E: ::fidl_next::Encoder,
455    {
456        #[inline]
457        fn encode(
458            self,
459            encoder_: &mut ___E,
460            out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceTransferRequest<'static>>,
461            _: (),
462        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
463            ::fidl_next::munge! {
464                let crate::wire::DeviceTransferRequest {
465
466                    transactions,
467
468                } = out_;
469            }
470
471            ::fidl_next::Encode::encode(&self.transactions, encoder_, transactions, (256, ()))?;
472
473            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(transactions.as_mut_ptr()) };
474            ::fidl_next::Constrained::validate(_field, (256, ()))?;
475
476            Ok(())
477        }
478    }
479
480    unsafe impl<___E>
481        ::fidl_next::EncodeOption<
482            ::fidl_next::WireBox<'static, crate::wire::DeviceTransferRequest<'static>>,
483            ___E,
484        > for DeviceTransferRequest
485    where
486        ___E: ::fidl_next::Encoder + ?Sized,
487        DeviceTransferRequest:
488            ::fidl_next::Encode<crate::wire::DeviceTransferRequest<'static>, ___E>,
489    {
490        #[inline]
491        fn encode_option(
492            this: ::core::option::Option<Self>,
493            encoder: &mut ___E,
494            out: &mut ::core::mem::MaybeUninit<
495                ::fidl_next::WireBox<'static, crate::wire::DeviceTransferRequest<'static>>,
496            >,
497            _: (),
498        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
499            if let Some(inner) = this {
500                ::fidl_next::EncoderExt::encode_next(encoder, inner, ())?;
501                ::fidl_next::WireBox::encode_present(out);
502            } else {
503                ::fidl_next::WireBox::encode_absent(out);
504            }
505
506            Ok(())
507        }
508    }
509
510    unsafe impl<'a, ___E>
511        ::fidl_next::EncodeOption<
512            ::fidl_next::WireBox<'static, crate::wire::DeviceTransferRequest<'static>>,
513            ___E,
514        > for &'a DeviceTransferRequest
515    where
516        ___E: ::fidl_next::Encoder + ?Sized,
517        &'a DeviceTransferRequest:
518            ::fidl_next::Encode<crate::wire::DeviceTransferRequest<'static>, ___E>,
519    {
520        #[inline]
521        fn encode_option(
522            this: ::core::option::Option<Self>,
523            encoder: &mut ___E,
524            out: &mut ::core::mem::MaybeUninit<
525                ::fidl_next::WireBox<'static, crate::wire::DeviceTransferRequest<'static>>,
526            >,
527            _: (),
528        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
529            if let Some(inner) = this {
530                ::fidl_next::EncoderExt::encode_next(encoder, inner, ())?;
531                ::fidl_next::WireBox::encode_present(out);
532            } else {
533                ::fidl_next::WireBox::encode_absent(out);
534            }
535
536            Ok(())
537        }
538    }
539
540    impl<'de> ::fidl_next::FromWire<crate::wire::DeviceTransferRequest<'de>> for DeviceTransferRequest {
541        #[inline]
542        fn from_wire(wire: crate::wire::DeviceTransferRequest<'de>) -> Self {
543            Self { transactions: ::fidl_next::FromWire::from_wire(wire.transactions) }
544        }
545    }
546
547    impl<'de> ::fidl_next::FromWireRef<crate::wire::DeviceTransferRequest<'de>>
548        for DeviceTransferRequest
549    {
550        #[inline]
551        fn from_wire_ref(wire: &crate::wire::DeviceTransferRequest<'de>) -> Self {
552            Self { transactions: ::fidl_next::FromWireRef::from_wire_ref(&wire.transactions) }
553        }
554    }
555
556    #[doc = " Used to return data from read transfers.\n"]
557    pub type ReadData = ::std::vec::Vec<u8>;
558
559    #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
560    pub struct DeviceTransferResponse {
561        pub read_data: ::std::vec::Vec<::std::vec::Vec<u8>>,
562    }
563
564    unsafe impl<___E> ::fidl_next::Encode<crate::wire::DeviceTransferResponse<'static>, ___E>
565        for DeviceTransferResponse
566    where
567        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
568        ___E: ::fidl_next::Encoder,
569    {
570        #[inline]
571        fn encode(
572            self,
573            encoder_: &mut ___E,
574            out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceTransferResponse<'static>>,
575            _: (),
576        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
577            ::fidl_next::munge! {
578                let crate::wire::DeviceTransferResponse {
579                    read_data,
580
581                } = out_;
582            }
583
584            ::fidl_next::Encode::encode(self.read_data, encoder_, read_data, (256, (32768, ())))?;
585
586            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(read_data.as_mut_ptr()) };
587            ::fidl_next::Constrained::validate(_field, (256, (32768, ())))?;
588
589            Ok(())
590        }
591    }
592
593    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DeviceTransferResponse<'static>, ___E>
594        for &'a DeviceTransferResponse
595    where
596        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
597        ___E: ::fidl_next::Encoder,
598    {
599        #[inline]
600        fn encode(
601            self,
602            encoder_: &mut ___E,
603            out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceTransferResponse<'static>>,
604            _: (),
605        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
606            ::fidl_next::munge! {
607                let crate::wire::DeviceTransferResponse {
608
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::WireBox<'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::WireBox<'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::WireBox::encode_present(out);
645            } else {
646                ::fidl_next::WireBox::encode_absent(out);
647            }
648
649            Ok(())
650        }
651    }
652
653    unsafe impl<'a, ___E>
654        ::fidl_next::EncodeOption<
655            ::fidl_next::WireBox<'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::WireBox<'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::WireBox::encode_present(out);
675            } else {
676                ::fidl_next::WireBox::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
751                    name,
752
753                } = out_;
754            }
755
756            ::fidl_next::Encode::encode(&self.name, encoder_, name, 64)?;
757
758            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(name.as_mut_ptr()) };
759            ::fidl_next::Constrained::validate(_field, 64)?;
760
761            Ok(())
762        }
763    }
764
765    unsafe impl<___E>
766        ::fidl_next::EncodeOption<
767            ::fidl_next::WireBox<'static, crate::wire::DeviceGetNameResponse<'static>>,
768            ___E,
769        > for DeviceGetNameResponse
770    where
771        ___E: ::fidl_next::Encoder + ?Sized,
772        DeviceGetNameResponse:
773            ::fidl_next::Encode<crate::wire::DeviceGetNameResponse<'static>, ___E>,
774    {
775        #[inline]
776        fn encode_option(
777            this: ::core::option::Option<Self>,
778            encoder: &mut ___E,
779            out: &mut ::core::mem::MaybeUninit<
780                ::fidl_next::WireBox<'static, crate::wire::DeviceGetNameResponse<'static>>,
781            >,
782            _: (),
783        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
784            if let Some(inner) = this {
785                ::fidl_next::EncoderExt::encode_next(encoder, inner, ())?;
786                ::fidl_next::WireBox::encode_present(out);
787            } else {
788                ::fidl_next::WireBox::encode_absent(out);
789            }
790
791            Ok(())
792        }
793    }
794
795    unsafe impl<'a, ___E>
796        ::fidl_next::EncodeOption<
797            ::fidl_next::WireBox<'static, crate::wire::DeviceGetNameResponse<'static>>,
798            ___E,
799        > for &'a DeviceGetNameResponse
800    where
801        ___E: ::fidl_next::Encoder + ?Sized,
802        &'a DeviceGetNameResponse:
803            ::fidl_next::Encode<crate::wire::DeviceGetNameResponse<'static>, ___E>,
804    {
805        #[inline]
806        fn encode_option(
807            this: ::core::option::Option<Self>,
808            encoder: &mut ___E,
809            out: &mut ::core::mem::MaybeUninit<
810                ::fidl_next::WireBox<'static, crate::wire::DeviceGetNameResponse<'static>>,
811            >,
812            _: (),
813        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
814            if let Some(inner) = this {
815                ::fidl_next::EncoderExt::encode_next(encoder, inner, ())?;
816                ::fidl_next::WireBox::encode_present(out);
817            } else {
818                ::fidl_next::WireBox::encode_absent(out);
819            }
820
821            Ok(())
822        }
823    }
824
825    impl<'de> ::fidl_next::FromWire<crate::wire::DeviceGetNameResponse<'de>> for DeviceGetNameResponse {
826        #[inline]
827        fn from_wire(wire: crate::wire::DeviceGetNameResponse<'de>) -> Self {
828            Self { name: ::fidl_next::FromWire::from_wire(wire.name) }
829        }
830    }
831
832    impl<'de> ::fidl_next::FromWireRef<crate::wire::DeviceGetNameResponse<'de>>
833        for DeviceGetNameResponse
834    {
835        #[inline]
836        fn from_wire_ref(wire: &crate::wire::DeviceGetNameResponse<'de>) -> Self {
837            Self { name: ::fidl_next::FromWireRef::from_wire_ref(&wire.name) }
838        }
839    }
840}
841
842pub mod wire {
843
844    /// The wire type corresponding to [`DataTransfer`].
845    #[repr(transparent)]
846    pub struct DataTransfer<'de> {
847        pub(crate) raw: ::fidl_next::RawWireUnion,
848        pub(crate) _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
849    }
850
851    impl<'de> Drop for DataTransfer<'de> {
852        fn drop(&mut self) {
853            match self.raw.ordinal() {
854                1 => {
855                    let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireU32>() };
856                }
857
858                2 => {
859                    let _ = unsafe {
860                        self.raw.get().read_unchecked::<::fidl_next::WireVector<'de, u8>>()
861                    };
862                }
863
864                _ => (),
865            }
866        }
867    }
868
869    unsafe impl ::fidl_next::Wire for DataTransfer<'static> {
870        type Owned<'de> = DataTransfer<'de>;
871
872        #[inline]
873        fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
874            ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
875            ::fidl_next::RawWireUnion::zero_padding(raw);
876        }
877    }
878
879    pub mod data_transfer {
880        pub enum Ref<'de> {
881            ReadSize(&'de ::fidl_next::WireU32),
882
883            WriteData(&'de ::fidl_next::WireVector<'de, u8>),
884
885            UnknownOrdinal_(u64),
886        }
887    }
888
889    impl<'de> DataTransfer<'de> {
890        pub fn as_ref(&self) -> crate::wire::data_transfer::Ref<'_> {
891            match self.raw.ordinal() {
892                1 => crate::wire::data_transfer::Ref::ReadSize(unsafe {
893                    self.raw.get().deref_unchecked::<::fidl_next::WireU32>()
894                }),
895
896                2 => crate::wire::data_transfer::Ref::WriteData(unsafe {
897                    self.raw.get().deref_unchecked::<::fidl_next::WireVector<'_, u8>>()
898                }),
899
900                unknown => crate::wire::data_transfer::Ref::UnknownOrdinal_(unknown),
901            }
902        }
903    }
904
905    unsafe impl<___D> ::fidl_next::Decode<___D> for DataTransfer<'static>
906    where
907        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
908        ___D: ::fidl_next::Decoder,
909    {
910        fn decode(
911            mut slot: ::fidl_next::Slot<'_, Self>,
912            decoder: &mut ___D,
913            _: (),
914        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
915            ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
916            match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
917                1 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireU32>(
918                    raw,
919                    decoder,
920                    (),
921                )?,
922
923                2 => ::fidl_next::RawWireUnion::decode_as::<
924                    ___D,
925                    ::fidl_next::WireVector<'static, u8>,
926                >(raw, decoder, (32768, ()))?,
927
928                _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
929            }
930
931            Ok(())
932        }
933    }
934
935    impl<'de> ::core::fmt::Debug for DataTransfer<'de> {
936        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
937            match self.raw.ordinal() {
938                1 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireU32>().fmt(f) },
939                2 => unsafe {
940                    self.raw.get().deref_unchecked::<::fidl_next::WireVector<'_, u8>>().fmt(f)
941                },
942                _ => unsafe { ::core::hint::unreachable_unchecked() },
943            }
944        }
945    }
946
947    impl<'de> ::fidl_next::IntoNatural for DataTransfer<'de> {
948        type Natural = crate::natural::DataTransfer;
949    }
950
951    impl ::fidl_next::Unconstrained for DataTransfer<'static> {}
952
953    /// The wire type corresponding to [`Transaction`].
954    #[repr(C)]
955    pub struct Transaction<'de> {
956        pub(crate) table: ::fidl_next::WireTable<'de>,
957    }
958
959    impl<'de> Drop for Transaction<'de> {
960        fn drop(&mut self) {
961            let _ = self.table.get(1).map(|envelope| unsafe {
962                envelope.read_unchecked::<crate::wire::DataTransfer<'de>>()
963            });
964
965            let _ = self.table.get(2).map(|envelope| unsafe { envelope.read_unchecked::<bool>() });
966        }
967    }
968
969    unsafe impl ::fidl_next::Wire for Transaction<'static> {
970        type Owned<'de> = Transaction<'de>;
971
972        #[inline]
973        fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
974            ::fidl_next::munge!(let Self { table } = out);
975            ::fidl_next::WireTable::zero_padding(table);
976        }
977    }
978
979    unsafe impl<___D> ::fidl_next::Decode<___D> for Transaction<'static>
980    where
981        ___D: ::fidl_next::Decoder + ?Sized,
982    {
983        fn decode(
984            slot: ::fidl_next::Slot<'_, Self>,
985            decoder: &mut ___D,
986            _: (),
987        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
988            ::fidl_next::munge!(let Self { table } = slot);
989
990            ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
991                match ordinal {
992                    0 => unsafe { ::core::hint::unreachable_unchecked() },
993
994                    1 => {
995                        ::fidl_next::WireEnvelope::decode_as::<
996                            ___D,
997                            crate::wire::DataTransfer<'static>,
998                        >(slot.as_mut(), decoder, ())?;
999
1000                        Ok(())
1001                    }
1002
1003                    2 => {
1004                        ::fidl_next::WireEnvelope::decode_as::<___D, bool>(
1005                            slot.as_mut(),
1006                            decoder,
1007                            (),
1008                        )?;
1009
1010                        Ok(())
1011                    }
1012
1013                    _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
1014                }
1015            })
1016        }
1017    }
1018
1019    impl<'de> Transaction<'de> {
1020        pub fn data_transfer(&self) -> ::core::option::Option<&crate::wire::DataTransfer<'de>> {
1021            unsafe { Some(self.table.get(1)?.deref_unchecked()) }
1022        }
1023
1024        pub fn stop(&self) -> ::core::option::Option<&bool> {
1025            unsafe { Some(self.table.get(2)?.deref_unchecked()) }
1026        }
1027    }
1028
1029    impl<'de> ::core::fmt::Debug for Transaction<'de> {
1030        fn fmt(
1031            &self,
1032            f: &mut ::core::fmt::Formatter<'_>,
1033        ) -> ::core::result::Result<(), ::core::fmt::Error> {
1034            f.debug_struct("Transaction")
1035                .field("data_transfer", &self.data_transfer())
1036                .field("stop", &self.stop())
1037                .finish()
1038        }
1039    }
1040
1041    impl<'de> ::fidl_next::IntoNatural for Transaction<'de> {
1042        type Natural = crate::natural::Transaction;
1043    }
1044
1045    impl ::fidl_next::Unconstrained for Transaction<'_> {}
1046
1047    /// The wire type corresponding to [`DeviceTransferRequest`].
1048    #[derive(Debug)]
1049    #[repr(C)]
1050    pub struct DeviceTransferRequest<'de> {
1051        pub transactions: ::fidl_next::WireVector<'de, crate::wire::Transaction<'de>>,
1052    }
1053
1054    static_assertions::const_assert_eq!(std::mem::size_of::<DeviceTransferRequest<'_>>(), 16);
1055    static_assertions::const_assert_eq!(std::mem::align_of::<DeviceTransferRequest<'_>>(), 8);
1056
1057    static_assertions::const_assert_eq!(
1058        std::mem::offset_of!(DeviceTransferRequest<'_>, transactions),
1059        0
1060    );
1061
1062    unsafe impl ::fidl_next::Wire for DeviceTransferRequest<'static> {
1063        type Owned<'de> = DeviceTransferRequest<'de>;
1064
1065        #[inline]
1066        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1067            ::fidl_next::munge! {
1068                let Self {
1069
1070                    transactions,
1071
1072                } = &mut *out_;
1073            }
1074
1075            ::fidl_next::Wire::zero_padding(transactions);
1076        }
1077    }
1078
1079    unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceTransferRequest<'static>
1080    where
1081        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1082        ___D: ::fidl_next::Decoder,
1083    {
1084        fn decode(
1085            slot_: ::fidl_next::Slot<'_, Self>,
1086            decoder_: &mut ___D,
1087            _: (),
1088        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1089            ::fidl_next::munge! {
1090                let Self {
1091
1092                    mut transactions,
1093
1094                } = slot_;
1095            }
1096
1097            let _field = transactions.as_mut();
1098            ::fidl_next::Constrained::validate(_field, (256, ()))?;
1099            ::fidl_next::Decode::decode(transactions.as_mut(), decoder_, (256, ()))?;
1100
1101            let transactions = unsafe { transactions.deref_unchecked() };
1102
1103            if transactions.len() > 256 {
1104                return Err(::fidl_next::DecodeError::VectorTooLong {
1105                    size: transactions.len() as u64,
1106                    limit: 256,
1107                });
1108            }
1109
1110            Ok(())
1111        }
1112    }
1113
1114    impl<'de> ::fidl_next::IntoNatural for DeviceTransferRequest<'de> {
1115        type Natural = crate::natural::DeviceTransferRequest;
1116    }
1117
1118    impl ::fidl_next::Unconstrained for DeviceTransferRequest<'static> {}
1119
1120    /// The wire type corresponding to [`ReadData`](crate::natural::ReadData).
1121    pub type ReadData<'de> = ::fidl_next::WireVector<'de, u8>;
1122
1123    /// The wire type corresponding to [`DeviceTransferResponse`].
1124    #[derive(Debug)]
1125    #[repr(C)]
1126    pub struct DeviceTransferResponse<'de> {
1127        pub read_data: ::fidl_next::WireVector<'de, ::fidl_next::WireVector<'de, u8>>,
1128    }
1129
1130    static_assertions::const_assert_eq!(std::mem::size_of::<DeviceTransferResponse<'_>>(), 16);
1131    static_assertions::const_assert_eq!(std::mem::align_of::<DeviceTransferResponse<'_>>(), 8);
1132
1133    static_assertions::const_assert_eq!(
1134        std::mem::offset_of!(DeviceTransferResponse<'_>, read_data),
1135        0
1136    );
1137
1138    unsafe impl ::fidl_next::Wire for DeviceTransferResponse<'static> {
1139        type Owned<'de> = DeviceTransferResponse<'de>;
1140
1141        #[inline]
1142        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1143            ::fidl_next::munge! {
1144                let Self {
1145
1146                    read_data,
1147
1148                } = &mut *out_;
1149            }
1150
1151            ::fidl_next::Wire::zero_padding(read_data);
1152        }
1153    }
1154
1155    unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceTransferResponse<'static>
1156    where
1157        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1158        ___D: ::fidl_next::Decoder,
1159    {
1160        fn decode(
1161            slot_: ::fidl_next::Slot<'_, Self>,
1162            decoder_: &mut ___D,
1163            _: (),
1164        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1165            ::fidl_next::munge! {
1166                let Self {
1167
1168                    mut read_data,
1169
1170                } = slot_;
1171            }
1172
1173            let _field = read_data.as_mut();
1174            ::fidl_next::Constrained::validate(_field, (256, (32768, ())))?;
1175            ::fidl_next::Decode::decode(read_data.as_mut(), decoder_, (256, (32768, ())))?;
1176
1177            let read_data = unsafe { read_data.deref_unchecked() };
1178
1179            if read_data.len() > 256 {
1180                return Err(::fidl_next::DecodeError::VectorTooLong {
1181                    size: read_data.len() as u64,
1182                    limit: 256,
1183                });
1184            }
1185
1186            Ok(())
1187        }
1188    }
1189
1190    impl<'de> ::fidl_next::IntoNatural for DeviceTransferResponse<'de> {
1191        type Natural = crate::natural::DeviceTransferResponse;
1192    }
1193
1194    impl ::fidl_next::Unconstrained for DeviceTransferResponse<'static> {}
1195
1196    /// The wire type corresponding to [`DeviceGetNameResponse`].
1197    #[derive(Debug)]
1198    #[repr(C)]
1199    pub struct DeviceGetNameResponse<'de> {
1200        pub name: ::fidl_next::WireString<'de>,
1201    }
1202
1203    static_assertions::const_assert_eq!(std::mem::size_of::<DeviceGetNameResponse<'_>>(), 16);
1204    static_assertions::const_assert_eq!(std::mem::align_of::<DeviceGetNameResponse<'_>>(), 8);
1205
1206    static_assertions::const_assert_eq!(std::mem::offset_of!(DeviceGetNameResponse<'_>, name), 0);
1207
1208    unsafe impl ::fidl_next::Wire for DeviceGetNameResponse<'static> {
1209        type Owned<'de> = DeviceGetNameResponse<'de>;
1210
1211        #[inline]
1212        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1213            ::fidl_next::munge! {
1214                let Self {
1215
1216                    name,
1217
1218                } = &mut *out_;
1219            }
1220
1221            ::fidl_next::Wire::zero_padding(name);
1222        }
1223    }
1224
1225    unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceGetNameResponse<'static>
1226    where
1227        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1228        ___D: ::fidl_next::Decoder,
1229    {
1230        fn decode(
1231            slot_: ::fidl_next::Slot<'_, Self>,
1232            decoder_: &mut ___D,
1233            _: (),
1234        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1235            ::fidl_next::munge! {
1236                let Self {
1237
1238                    mut name,
1239
1240                } = slot_;
1241            }
1242
1243            let _field = name.as_mut();
1244            ::fidl_next::Constrained::validate(_field, 64)?;
1245            ::fidl_next::Decode::decode(name.as_mut(), decoder_, 64)?;
1246
1247            let name = unsafe { name.deref_unchecked() };
1248
1249            if name.len() > 64 {
1250                return Err(::fidl_next::DecodeError::VectorTooLong {
1251                    size: name.len() as u64,
1252                    limit: 64,
1253                });
1254            }
1255
1256            Ok(())
1257        }
1258    }
1259
1260    impl<'de> ::fidl_next::IntoNatural for DeviceGetNameResponse<'de> {
1261        type Natural = crate::natural::DeviceGetNameResponse;
1262    }
1263
1264    impl ::fidl_next::Unconstrained for DeviceGetNameResponse<'static> {}
1265}
1266
1267pub mod wire_optional {
1268
1269    #[repr(transparent)]
1270    pub struct DataTransfer<'de> {
1271        pub(crate) raw: ::fidl_next::RawWireUnion,
1272        pub(crate) _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
1273    }
1274
1275    unsafe impl ::fidl_next::Wire for DataTransfer<'static> {
1276        type Owned<'de> = DataTransfer<'de>;
1277
1278        #[inline]
1279        fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
1280            ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
1281            ::fidl_next::RawWireUnion::zero_padding(raw);
1282        }
1283    }
1284
1285    impl<'de> DataTransfer<'de> {
1286        pub fn is_some(&self) -> bool {
1287            self.raw.is_some()
1288        }
1289
1290        pub fn is_none(&self) -> bool {
1291            self.raw.is_none()
1292        }
1293
1294        pub fn as_ref(&self) -> ::core::option::Option<&crate::wire::DataTransfer<'de>> {
1295            if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None }
1296        }
1297
1298        pub fn into_option(self) -> ::core::option::Option<crate::wire::DataTransfer<'de>> {
1299            if self.is_some() {
1300                Some(crate::wire::DataTransfer {
1301                    raw: self.raw,
1302                    _phantom: ::core::marker::PhantomData,
1303                })
1304            } else {
1305                None
1306            }
1307        }
1308    }
1309
1310    unsafe impl<___D> ::fidl_next::Decode<___D> for DataTransfer<'static>
1311    where
1312        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1313        ___D: ::fidl_next::Decoder,
1314    {
1315        fn decode(
1316            mut slot: ::fidl_next::Slot<'_, Self>,
1317            decoder: &mut ___D,
1318            _: (),
1319        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1320            ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
1321            match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
1322                1 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireU32>(
1323                    raw,
1324                    decoder,
1325                    (),
1326                )?,
1327
1328                2 => ::fidl_next::RawWireUnion::decode_as::<
1329                    ___D,
1330                    ::fidl_next::WireVector<'static, u8>,
1331                >(raw, decoder, (32768, ()))?,
1332
1333                0 => ::fidl_next::RawWireUnion::decode_absent(raw)?,
1334                _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
1335            }
1336
1337            Ok(())
1338        }
1339    }
1340
1341    impl<'de> ::core::fmt::Debug for DataTransfer<'de> {
1342        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1343            self.as_ref().fmt(f)
1344        }
1345    }
1346
1347    impl<'de> ::fidl_next::IntoNatural for DataTransfer<'de> {
1348        type Natural = ::core::option::Option<crate::natural::DataTransfer>;
1349    }
1350
1351    impl ::fidl_next::Unconstrained for DataTransfer<'static> {}
1352}
1353
1354pub mod generic {
1355
1356    pub struct DeviceTransferRequest<T0> {
1357        pub transactions: T0,
1358    }
1359
1360    unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceTransferRequest<'static>, ___E>
1361        for DeviceTransferRequest<T0>
1362    where
1363        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1364        ___E: ::fidl_next::Encoder,
1365        T0: ::fidl_next::Encode<
1366                ::fidl_next::WireVector<'static, crate::wire::Transaction<'static>>,
1367                ___E,
1368            >,
1369    {
1370        #[inline]
1371        fn encode(
1372            self,
1373            encoder_: &mut ___E,
1374            out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceTransferRequest<'static>>,
1375            _: (),
1376        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1377            ::fidl_next::munge! {
1378                let crate::wire::DeviceTransferRequest {
1379
1380                    transactions,
1381
1382                } = out_;
1383            }
1384
1385            ::fidl_next::Encode::encode(self.transactions, encoder_, transactions, (256, ()))?;
1386
1387            Ok(())
1388        }
1389    }
1390
1391    pub struct DeviceTransferResponse<T0> {
1392        pub read_data: T0,
1393    }
1394
1395    unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceTransferResponse<'static>, ___E>
1396        for DeviceTransferResponse<T0>
1397    where
1398        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1399        ___E: ::fidl_next::Encoder,
1400        T0: ::fidl_next::Encode<
1401                ::fidl_next::WireVector<'static, ::fidl_next::WireVector<'static, u8>>,
1402                ___E,
1403            >,
1404    {
1405        #[inline]
1406        fn encode(
1407            self,
1408            encoder_: &mut ___E,
1409            out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceTransferResponse<'static>>,
1410            _: (),
1411        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1412            ::fidl_next::munge! {
1413                let crate::wire::DeviceTransferResponse {
1414
1415                    read_data,
1416
1417                } = out_;
1418            }
1419
1420            ::fidl_next::Encode::encode(self.read_data, encoder_, read_data, (256, (32768, ())))?;
1421
1422            Ok(())
1423        }
1424    }
1425
1426    pub struct DeviceGetNameResponse<T0> {
1427        pub name: T0,
1428    }
1429
1430    unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceGetNameResponse<'static>, ___E>
1431        for DeviceGetNameResponse<T0>
1432    where
1433        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1434        ___E: ::fidl_next::Encoder,
1435        T0: ::fidl_next::Encode<::fidl_next::WireString<'static>, ___E>,
1436    {
1437        #[inline]
1438        fn encode(
1439            self,
1440            encoder_: &mut ___E,
1441            out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetNameResponse<'static>>,
1442            _: (),
1443        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1444            ::fidl_next::munge! {
1445                let crate::wire::DeviceGetNameResponse {
1446
1447                    name,
1448
1449                } = out_;
1450            }
1451
1452            ::fidl_next::Encode::encode(self.name, encoder_, name, 64)?;
1453
1454            Ok(())
1455        }
1456    }
1457}
1458
1459pub use self::natural::*;
1460
1461#[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"]
1462pub const MAX_TRANSFER_SIZE: u32 = 32768 as u32;
1463
1464#[doc = " The maximum number of transactions that can be specified in a call to `Transfer`.\n"]
1465pub const MAX_COUNT_TRANSACTIONS: u32 = 256 as u32;
1466
1467#[doc = " Maximum length of the I2C Channel name.\n"]
1468pub const MAX_I2_C_NAME_LEN: u32 = 64 as u32;
1469
1470/// The type corresponding to the Device protocol.
1471#[derive(PartialEq, Debug)]
1472pub struct Device;
1473
1474impl ::fidl_next::Discoverable for Device {
1475    const PROTOCOL_NAME: &'static str = "fuchsia.hardware.i2c.Device";
1476}
1477
1478#[cfg(target_os = "fuchsia")]
1479impl ::fidl_next::HasTransport for Device {
1480    type Transport = ::fidl_next::fuchsia::zx::Channel;
1481}
1482
1483pub mod device {
1484    pub mod prelude {
1485        pub use crate::{Device, DeviceClientHandler, DeviceServerHandler, device};
1486
1487        pub use crate::natural::DeviceTransferRequest;
1488
1489        pub use crate::natural::DeviceGetNameResponse;
1490
1491        pub use crate::natural::DeviceTransferResponse;
1492    }
1493
1494    pub struct Transfer;
1495
1496    impl ::fidl_next::Method for Transfer {
1497        const ORDINAL: u64 = 871058866166117179;
1498        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1499            ::fidl_next::protocol::Flexibility::Strict;
1500
1501        type Protocol = crate::Device;
1502
1503        type Request = crate::wire::DeviceTransferRequest<'static>;
1504    }
1505
1506    impl ::fidl_next::TwoWayMethod for Transfer {
1507        type Response = ::fidl_next::WireResult<
1508            'static,
1509            crate::wire::DeviceTransferResponse<'static>,
1510            ::fidl_next::WireI32,
1511        >;
1512    }
1513
1514    impl<___R> ::fidl_next::Respond<___R> for Transfer {
1515        type Output = ::core::result::Result<
1516            crate::generic::DeviceTransferResponse<___R>,
1517            ::fidl_next::util::Never,
1518        >;
1519
1520        fn respond(response: ___R) -> Self::Output {
1521            ::core::result::Result::Ok(crate::generic::DeviceTransferResponse {
1522                read_data: response,
1523            })
1524        }
1525    }
1526
1527    impl<___R> ::fidl_next::RespondErr<___R> for Transfer {
1528        type Output = ::core::result::Result<::fidl_next::util::Never, ___R>;
1529
1530        fn respond_err(response: ___R) -> Self::Output {
1531            ::core::result::Result::Err(response)
1532        }
1533    }
1534
1535    pub struct GetName;
1536
1537    impl ::fidl_next::Method for GetName {
1538        const ORDINAL: u64 = 8381876914474840322;
1539        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1540            ::fidl_next::protocol::Flexibility::Strict;
1541
1542        type Protocol = crate::Device;
1543
1544        type Request = ();
1545    }
1546
1547    impl ::fidl_next::TwoWayMethod for GetName {
1548        type Response = ::fidl_next::WireResult<
1549            'static,
1550            crate::wire::DeviceGetNameResponse<'static>,
1551            ::fidl_next::WireI32,
1552        >;
1553    }
1554
1555    impl<___R> ::fidl_next::Respond<___R> for GetName {
1556        type Output = ::core::result::Result<
1557            crate::generic::DeviceGetNameResponse<___R>,
1558            ::fidl_next::util::Never,
1559        >;
1560
1561        fn respond(response: ___R) -> Self::Output {
1562            ::core::result::Result::Ok(crate::generic::DeviceGetNameResponse { name: response })
1563        }
1564    }
1565
1566    impl<___R> ::fidl_next::RespondErr<___R> for GetName {
1567        type Output = ::core::result::Result<::fidl_next::util::Never, ___R>;
1568
1569        fn respond_err(response: ___R) -> Self::Output {
1570            ::core::result::Result::Err(response)
1571        }
1572    }
1573
1574    mod ___detail {
1575        unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Device
1576        where
1577            ___T: ::fidl_next::Transport,
1578        {
1579            type Client = DeviceClient<___T>;
1580            type Server = DeviceServer<___T>;
1581        }
1582
1583        /// The client for the `Device` protocol.
1584        #[repr(transparent)]
1585        pub struct DeviceClient<___T: ::fidl_next::Transport> {
1586            #[allow(dead_code)]
1587            client: ::fidl_next::protocol::Client<___T>,
1588        }
1589
1590        impl<___T> DeviceClient<___T>
1591        where
1592            ___T: ::fidl_next::Transport,
1593        {
1594            #[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"]
1595            pub fn transfer(
1596                &self,
1597
1598                transactions: impl ::fidl_next::Encode<
1599                    ::fidl_next::WireVector<'static, crate::wire::Transaction<'static>>,
1600                    <___T as ::fidl_next::Transport>::SendBuffer,
1601                >,
1602            ) -> ::fidl_next::TwoWayFuture<'_, super::Transfer, ___T>
1603            where
1604                <___T as ::fidl_next::Transport>::SendBuffer:
1605                    ::fidl_next::encoder::InternalHandleEncoder,
1606                <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
1607            {
1608                self.transfer_with(crate::generic::DeviceTransferRequest { transactions })
1609            }
1610
1611            #[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"]
1612            pub fn transfer_with<___R>(
1613                &self,
1614                request: ___R,
1615            ) -> ::fidl_next::TwoWayFuture<'_, super::Transfer, ___T>
1616            where
1617                ___R: ::fidl_next::Encode<
1618                        crate::wire::DeviceTransferRequest<'static>,
1619                        <___T as ::fidl_next::Transport>::SendBuffer,
1620                    >,
1621            {
1622                ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1623                    871058866166117179,
1624                    <super::Transfer as ::fidl_next::Method>::FLEXIBILITY,
1625                    request,
1626                ))
1627            }
1628
1629            #[doc = " Get the name of this I2C Device. Returns ZX_ERR_NOT_SUPPORTED if the\n name is unspecified or the empty string.\n"]
1630            pub fn get_name(&self) -> ::fidl_next::TwoWayFuture<'_, super::GetName, ___T> {
1631                ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1632                    8381876914474840322,
1633                    <super::GetName as ::fidl_next::Method>::FLEXIBILITY,
1634                    (),
1635                ))
1636            }
1637        }
1638
1639        /// The server for the `Device` protocol.
1640        #[repr(transparent)]
1641        pub struct DeviceServer<___T: ::fidl_next::Transport> {
1642            server: ::fidl_next::protocol::Server<___T>,
1643        }
1644
1645        impl<___T> DeviceServer<___T> where ___T: ::fidl_next::Transport {}
1646    }
1647}
1648
1649/// A client handler for the Device protocol.
1650///
1651/// See [`Device`] for more details.
1652pub trait DeviceClientHandler<
1653    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1654    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1655>
1656{
1657}
1658
1659impl<___T> DeviceClientHandler<___T> for ::fidl_next::IgnoreEvents where ___T: ::fidl_next::Transport
1660{}
1661
1662impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Device
1663where
1664    ___H: DeviceClientHandler<___T> + ::core::marker::Send,
1665    ___T: ::fidl_next::Transport,
1666{
1667    async fn on_event(
1668        handler: &mut ___H,
1669        ordinal: u64,
1670        flexibility: ::fidl_next::protocol::Flexibility,
1671        buffer: ___T::RecvBuffer,
1672    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1673        match ordinal {
1674            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
1675        }
1676    }
1677}
1678
1679/// A server handler for the Device protocol.
1680///
1681/// See [`Device`] for more details.
1682pub trait DeviceServerHandler<
1683    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1684    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1685>
1686{
1687    #[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"]
1688    fn transfer(
1689        &mut self,
1690
1691        request: ::fidl_next::Request<device::Transfer, ___T>,
1692
1693        responder: ::fidl_next::Responder<device::Transfer, ___T>,
1694    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1695
1696    #[doc = " Get the name of this I2C Device. Returns ZX_ERR_NOT_SUPPORTED if the\n name is unspecified or the empty string.\n"]
1697    fn get_name(
1698        &mut self,
1699
1700        responder: ::fidl_next::Responder<device::GetName, ___T>,
1701    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1702}
1703
1704impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Device
1705where
1706    ___H: DeviceServerHandler<___T> + ::core::marker::Send,
1707    ___T: ::fidl_next::Transport,
1708    <device::Transfer as ::fidl_next::Method>::Request:
1709        ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
1710{
1711    async fn on_one_way(
1712        handler: &mut ___H,
1713        ordinal: u64,
1714        flexibility: ::fidl_next::protocol::Flexibility,
1715        buffer: ___T::RecvBuffer,
1716    ) -> ::core::result::Result<
1717        (),
1718        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1719    > {
1720        match ordinal {
1721            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
1722        }
1723    }
1724
1725    async fn on_two_way(
1726        handler: &mut ___H,
1727        ordinal: u64,
1728        flexibility: ::fidl_next::protocol::Flexibility,
1729        buffer: ___T::RecvBuffer,
1730        responder: ::fidl_next::protocol::Responder<___T>,
1731    ) -> ::core::result::Result<
1732        (),
1733        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1734    > {
1735        match ordinal {
1736            871058866166117179 => {
1737                let responder = ::fidl_next::Responder::from_untyped(responder);
1738
1739                match ::fidl_next::DecoderExt::decode(buffer) {
1740                    Ok(decoded) => {
1741                        handler
1742                            .transfer(::fidl_next::Request::from_decoded(decoded), responder)
1743                            .await;
1744                        Ok(())
1745                    }
1746                    Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1747                        ordinal: 871058866166117179,
1748                        error,
1749                    }),
1750                }
1751            }
1752
1753            8381876914474840322 => {
1754                let responder = ::fidl_next::Responder::from_untyped(responder);
1755
1756                handler.get_name(responder).await;
1757                Ok(())
1758            }
1759
1760            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
1761        }
1762    }
1763}
1764
1765/// Compatibility shims which mimic some API surfaces of the current Rust bindings.
1766pub mod compat {
1767
1768    impl ::fidl_next::CompatFrom<crate::DataTransfer> for ::fidl_fuchsia_hardware_i2c::DataTransfer {
1769        fn compat_from(value: crate::DataTransfer) -> Self {
1770            match value {
1771                crate::DataTransfer::ReadSize(value) => {
1772                    Self::ReadSize(::fidl_next::CompatFrom::compat_from(value))
1773                }
1774
1775                crate::DataTransfer::WriteData(value) => {
1776                    Self::WriteData(::fidl_next::CompatFrom::compat_from(value))
1777                }
1778
1779                crate::DataTransfer::UnknownOrdinal_(unknown_ordinal) => {
1780                    Self::__SourceBreaking { unknown_ordinal }
1781                }
1782            }
1783        }
1784    }
1785
1786    impl ::fidl_next::CompatFrom<::fidl_fuchsia_hardware_i2c::DataTransfer> for crate::DataTransfer {
1787        fn compat_from(value: ::fidl_fuchsia_hardware_i2c::DataTransfer) -> Self {
1788            match value {
1789                ::fidl_fuchsia_hardware_i2c::DataTransfer::ReadSize(value) => {
1790                    Self::ReadSize(::fidl_next::CompatFrom::compat_from(value))
1791                }
1792
1793                ::fidl_fuchsia_hardware_i2c::DataTransfer::WriteData(value) => {
1794                    Self::WriteData(::fidl_next::CompatFrom::compat_from(value))
1795                }
1796
1797                ::fidl_fuchsia_hardware_i2c::DataTransfer::__SourceBreaking { unknown_ordinal } => {
1798                    Self::UnknownOrdinal_(unknown_ordinal)
1799                }
1800            }
1801        }
1802    }
1803
1804    impl ::fidl_next::CompatFrom<crate::Transaction> for ::fidl_fuchsia_hardware_i2c::Transaction {
1805        fn compat_from(value: crate::Transaction) -> Self {
1806            Self {
1807                data_transfer: ::fidl_next::CompatFrom::compat_from(value.data_transfer),
1808
1809                stop: ::fidl_next::CompatFrom::compat_from(value.stop),
1810
1811                __source_breaking: ::fidl::marker::SourceBreaking,
1812            }
1813        }
1814    }
1815
1816    impl ::fidl_next::CompatFrom<::fidl_fuchsia_hardware_i2c::Transaction> for crate::Transaction {
1817        fn compat_from(value: ::fidl_fuchsia_hardware_i2c::Transaction) -> Self {
1818            Self {
1819                data_transfer: ::fidl_next::CompatFrom::compat_from(value.data_transfer),
1820
1821                stop: ::fidl_next::CompatFrom::compat_from(value.stop),
1822            }
1823        }
1824    }
1825
1826    impl ::fidl_next::CompatFrom<crate::DeviceTransferRequest>
1827        for ::fidl_fuchsia_hardware_i2c::DeviceTransferRequest
1828    {
1829        #[inline]
1830        fn compat_from(value: crate::DeviceTransferRequest) -> Self {
1831            Self { transactions: ::fidl_next::CompatFrom::compat_from(value.transactions) }
1832        }
1833    }
1834
1835    impl ::fidl_next::CompatFrom<::fidl_fuchsia_hardware_i2c::DeviceTransferRequest>
1836        for crate::DeviceTransferRequest
1837    {
1838        #[inline]
1839        fn compat_from(value: ::fidl_fuchsia_hardware_i2c::DeviceTransferRequest) -> Self {
1840            Self { transactions: ::fidl_next::CompatFrom::compat_from(value.transactions) }
1841        }
1842    }
1843
1844    impl ::fidl_next::CompatFrom<crate::DeviceTransferResponse>
1845        for ::fidl_fuchsia_hardware_i2c::DeviceTransferResponse
1846    {
1847        #[inline]
1848        fn compat_from(value: crate::DeviceTransferResponse) -> Self {
1849            Self { read_data: ::fidl_next::CompatFrom::compat_from(value.read_data) }
1850        }
1851    }
1852
1853    impl ::fidl_next::CompatFrom<::fidl_fuchsia_hardware_i2c::DeviceTransferResponse>
1854        for crate::DeviceTransferResponse
1855    {
1856        #[inline]
1857        fn compat_from(value: ::fidl_fuchsia_hardware_i2c::DeviceTransferResponse) -> Self {
1858            Self { read_data: ::fidl_next::CompatFrom::compat_from(value.read_data) }
1859        }
1860    }
1861
1862    impl ::fidl_next::CompatFrom<crate::DeviceGetNameResponse>
1863        for ::fidl_fuchsia_hardware_i2c::DeviceGetNameResponse
1864    {
1865        #[inline]
1866        fn compat_from(value: crate::DeviceGetNameResponse) -> Self {
1867            Self { name: ::fidl_next::CompatFrom::compat_from(value.name) }
1868        }
1869    }
1870
1871    impl ::fidl_next::CompatFrom<::fidl_fuchsia_hardware_i2c::DeviceGetNameResponse>
1872        for crate::DeviceGetNameResponse
1873    {
1874        #[inline]
1875        fn compat_from(value: ::fidl_fuchsia_hardware_i2c::DeviceGetNameResponse) -> Self {
1876            Self { name: ::fidl_next::CompatFrom::compat_from(value.name) }
1877        }
1878    }
1879
1880    #[cfg(target_os = "fuchsia")]
1881    /// An alias for a client over `zx::Channel` for the `Device`
1882    /// protocol.
1883    pub type DeviceProxy = ::fidl_next::Client<crate::Device>;
1884
1885    impl ::fidl_next::CompatFrom<crate::Device> for ::fidl_fuchsia_hardware_i2c::DeviceMarker {
1886        fn compat_from(_: crate::Device) -> Self {
1887            Self
1888        }
1889    }
1890
1891    impl ::fidl_next::CompatFrom<::fidl_fuchsia_hardware_i2c::DeviceMarker> for crate::Device {
1892        fn compat_from(_: ::fidl_fuchsia_hardware_i2c::DeviceMarker) -> Self {
1893            Self
1894        }
1895    }
1896
1897    #[cfg(target_os = "fuchsia")]
1898
1899    impl ::fidl_next::ClientCompatFrom<::fidl_fuchsia_hardware_i2c::DeviceProxy> for crate::Device {
1900        fn client_compat_from(
1901            proxy: ::fidl_fuchsia_hardware_i2c::DeviceProxy,
1902        ) -> ::fidl_next::ClientDispatcher<Self, ::fidl_next::fuchsia::zx::Channel> {
1903            let channel = ::fidl::endpoints::Proxy::into_channel(proxy).unwrap().into_zx_channel();
1904            let client_end = ::fidl_next::ClientEnd::from_untyped(channel);
1905            ::fidl_next::ClientDispatcher::new(client_end)
1906        }
1907    }
1908}