fidl_next_common_fuchsia_hardware_i2cimpl/
fidl_next_common_fuchsia_hardware_i2cimpl.rs

1// DO NOT EDIT: This file is machine-generated by fidlgen
2#![warn(clippy::all)]
3#![allow(unused_parens, unused_variables, unused_mut, unused_imports, unreachable_code)]
4
5pub mod natural {
6
7    #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
8    #[repr(C)]
9    pub struct DeviceGetMaxTransferSizeResponse {
10        pub size: u64,
11    }
12
13    unsafe impl<___E> ::fidl_next::Encode<crate::wire::DeviceGetMaxTransferSizeResponse, ___E>
14        for DeviceGetMaxTransferSizeResponse
15    where
16        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
17    {
18        const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
19            Self,
20            crate::wire::DeviceGetMaxTransferSizeResponse,
21        > = unsafe {
22            ::fidl_next::CopyOptimization::enable_if(
23                true && <u64 as ::fidl_next::Encode<::fidl_next::WireU64, ___E>>::COPY_OPTIMIZATION
24                    .is_enabled(),
25            )
26        };
27
28        #[inline]
29        fn encode(
30            self,
31            encoder_: &mut ___E,
32            out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetMaxTransferSizeResponse>,
33            _: (),
34        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
35            ::fidl_next::munge! {
36                let crate::wire::DeviceGetMaxTransferSizeResponse {
37                    size,
38
39                } = out_;
40            }
41
42            ::fidl_next::Encode::encode(self.size, encoder_, size, ())?;
43
44            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(size.as_mut_ptr()) };
45
46            Ok(())
47        }
48    }
49
50    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DeviceGetMaxTransferSizeResponse, ___E>
51        for &'a DeviceGetMaxTransferSizeResponse
52    where
53        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
54    {
55        #[inline]
56        fn encode(
57            self,
58            encoder_: &mut ___E,
59            out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetMaxTransferSizeResponse>,
60            _: (),
61        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
62            ::fidl_next::munge! {
63                let crate::wire::DeviceGetMaxTransferSizeResponse {
64
65                    size,
66
67                } = out_;
68            }
69
70            ::fidl_next::Encode::encode(&self.size, encoder_, size, ())?;
71
72            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(size.as_mut_ptr()) };
73
74            Ok(())
75        }
76    }
77
78    unsafe impl<___E>
79        ::fidl_next::EncodeOption<
80            ::fidl_next::WireBox<'static, crate::wire::DeviceGetMaxTransferSizeResponse>,
81            ___E,
82        > for DeviceGetMaxTransferSizeResponse
83    where
84        ___E: ::fidl_next::Encoder + ?Sized,
85        DeviceGetMaxTransferSizeResponse:
86            ::fidl_next::Encode<crate::wire::DeviceGetMaxTransferSizeResponse, ___E>,
87    {
88        #[inline]
89        fn encode_option(
90            this: ::core::option::Option<Self>,
91            encoder: &mut ___E,
92            out: &mut ::core::mem::MaybeUninit<
93                ::fidl_next::WireBox<'static, crate::wire::DeviceGetMaxTransferSizeResponse>,
94            >,
95            _: (),
96        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
97            if let Some(inner) = this {
98                ::fidl_next::EncoderExt::encode_next(encoder, inner, ())?;
99                ::fidl_next::WireBox::encode_present(out);
100            } else {
101                ::fidl_next::WireBox::encode_absent(out);
102            }
103
104            Ok(())
105        }
106    }
107
108    unsafe impl<'a, ___E>
109        ::fidl_next::EncodeOption<
110            ::fidl_next::WireBox<'static, crate::wire::DeviceGetMaxTransferSizeResponse>,
111            ___E,
112        > for &'a DeviceGetMaxTransferSizeResponse
113    where
114        ___E: ::fidl_next::Encoder + ?Sized,
115        &'a DeviceGetMaxTransferSizeResponse:
116            ::fidl_next::Encode<crate::wire::DeviceGetMaxTransferSizeResponse, ___E>,
117    {
118        #[inline]
119        fn encode_option(
120            this: ::core::option::Option<Self>,
121            encoder: &mut ___E,
122            out: &mut ::core::mem::MaybeUninit<
123                ::fidl_next::WireBox<'static, crate::wire::DeviceGetMaxTransferSizeResponse>,
124            >,
125            _: (),
126        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
127            if let Some(inner) = this {
128                ::fidl_next::EncoderExt::encode_next(encoder, inner, ())?;
129                ::fidl_next::WireBox::encode_present(out);
130            } else {
131                ::fidl_next::WireBox::encode_absent(out);
132            }
133
134            Ok(())
135        }
136    }
137
138    impl ::fidl_next::FromWire<crate::wire::DeviceGetMaxTransferSizeResponse>
139        for DeviceGetMaxTransferSizeResponse
140    {
141        const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
142            crate::wire::DeviceGetMaxTransferSizeResponse,
143            Self,
144        > = unsafe {
145            ::fidl_next::CopyOptimization::enable_if(
146                true && <u64 as ::fidl_next::FromWire<::fidl_next::WireU64>>::COPY_OPTIMIZATION
147                    .is_enabled(),
148            )
149        };
150
151        #[inline]
152        fn from_wire(wire: crate::wire::DeviceGetMaxTransferSizeResponse) -> Self {
153            Self { size: ::fidl_next::FromWire::from_wire(wire.size) }
154        }
155    }
156
157    impl ::fidl_next::FromWireRef<crate::wire::DeviceGetMaxTransferSizeResponse>
158        for DeviceGetMaxTransferSizeResponse
159    {
160        #[inline]
161        fn from_wire_ref(wire: &crate::wire::DeviceGetMaxTransferSizeResponse) -> Self {
162            Self { size: ::fidl_next::FromWireRef::from_wire_ref(&wire.size) }
163        }
164    }
165
166    #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
167    #[repr(C)]
168    pub struct DeviceSetBitrateRequest {
169        pub bitrate: u32,
170    }
171
172    unsafe impl<___E> ::fidl_next::Encode<crate::wire::DeviceSetBitrateRequest, ___E>
173        for DeviceSetBitrateRequest
174    where
175        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
176    {
177        const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
178            Self,
179            crate::wire::DeviceSetBitrateRequest,
180        > = unsafe {
181            ::fidl_next::CopyOptimization::enable_if(
182                true && <u32 as ::fidl_next::Encode<::fidl_next::WireU32, ___E>>::COPY_OPTIMIZATION
183                    .is_enabled(),
184            )
185        };
186
187        #[inline]
188        fn encode(
189            self,
190            encoder_: &mut ___E,
191            out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceSetBitrateRequest>,
192            _: (),
193        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
194            ::fidl_next::munge! {
195                let crate::wire::DeviceSetBitrateRequest {
196                    bitrate,
197
198                } = out_;
199            }
200
201            ::fidl_next::Encode::encode(self.bitrate, encoder_, bitrate, ())?;
202
203            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(bitrate.as_mut_ptr()) };
204
205            Ok(())
206        }
207    }
208
209    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DeviceSetBitrateRequest, ___E>
210        for &'a DeviceSetBitrateRequest
211    where
212        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
213    {
214        #[inline]
215        fn encode(
216            self,
217            encoder_: &mut ___E,
218            out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceSetBitrateRequest>,
219            _: (),
220        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
221            ::fidl_next::munge! {
222                let crate::wire::DeviceSetBitrateRequest {
223
224                    bitrate,
225
226                } = out_;
227            }
228
229            ::fidl_next::Encode::encode(&self.bitrate, encoder_, bitrate, ())?;
230
231            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(bitrate.as_mut_ptr()) };
232
233            Ok(())
234        }
235    }
236
237    unsafe impl<___E>
238        ::fidl_next::EncodeOption<
239            ::fidl_next::WireBox<'static, crate::wire::DeviceSetBitrateRequest>,
240            ___E,
241        > for DeviceSetBitrateRequest
242    where
243        ___E: ::fidl_next::Encoder + ?Sized,
244        DeviceSetBitrateRequest: ::fidl_next::Encode<crate::wire::DeviceSetBitrateRequest, ___E>,
245    {
246        #[inline]
247        fn encode_option(
248            this: ::core::option::Option<Self>,
249            encoder: &mut ___E,
250            out: &mut ::core::mem::MaybeUninit<
251                ::fidl_next::WireBox<'static, crate::wire::DeviceSetBitrateRequest>,
252            >,
253            _: (),
254        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
255            if let Some(inner) = this {
256                ::fidl_next::EncoderExt::encode_next(encoder, inner, ())?;
257                ::fidl_next::WireBox::encode_present(out);
258            } else {
259                ::fidl_next::WireBox::encode_absent(out);
260            }
261
262            Ok(())
263        }
264    }
265
266    unsafe impl<'a, ___E>
267        ::fidl_next::EncodeOption<
268            ::fidl_next::WireBox<'static, crate::wire::DeviceSetBitrateRequest>,
269            ___E,
270        > for &'a DeviceSetBitrateRequest
271    where
272        ___E: ::fidl_next::Encoder + ?Sized,
273        &'a DeviceSetBitrateRequest:
274            ::fidl_next::Encode<crate::wire::DeviceSetBitrateRequest, ___E>,
275    {
276        #[inline]
277        fn encode_option(
278            this: ::core::option::Option<Self>,
279            encoder: &mut ___E,
280            out: &mut ::core::mem::MaybeUninit<
281                ::fidl_next::WireBox<'static, crate::wire::DeviceSetBitrateRequest>,
282            >,
283            _: (),
284        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
285            if let Some(inner) = this {
286                ::fidl_next::EncoderExt::encode_next(encoder, inner, ())?;
287                ::fidl_next::WireBox::encode_present(out);
288            } else {
289                ::fidl_next::WireBox::encode_absent(out);
290            }
291
292            Ok(())
293        }
294    }
295
296    impl ::fidl_next::FromWire<crate::wire::DeviceSetBitrateRequest> for DeviceSetBitrateRequest {
297        const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
298            crate::wire::DeviceSetBitrateRequest,
299            Self,
300        > = unsafe {
301            ::fidl_next::CopyOptimization::enable_if(
302                true && <u32 as ::fidl_next::FromWire<::fidl_next::WireU32>>::COPY_OPTIMIZATION
303                    .is_enabled(),
304            )
305        };
306
307        #[inline]
308        fn from_wire(wire: crate::wire::DeviceSetBitrateRequest) -> Self {
309            Self { bitrate: ::fidl_next::FromWire::from_wire(wire.bitrate) }
310        }
311    }
312
313    impl ::fidl_next::FromWireRef<crate::wire::DeviceSetBitrateRequest> for DeviceSetBitrateRequest {
314        #[inline]
315        fn from_wire_ref(wire: &crate::wire::DeviceSetBitrateRequest) -> Self {
316            Self { bitrate: ::fidl_next::FromWireRef::from_wire_ref(&wire.bitrate) }
317        }
318    }
319
320    #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
321    #[repr(C)]
322    pub struct DeviceSetBitrateResponse {}
323
324    unsafe impl<___E> ::fidl_next::Encode<crate::wire::DeviceSetBitrateResponse, ___E>
325        for DeviceSetBitrateResponse
326    where
327        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
328    {
329        #[inline]
330        fn encode(
331            self,
332            encoder_: &mut ___E,
333            out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceSetBitrateResponse>,
334            _: (),
335        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
336            *out_ = ::core::mem::MaybeUninit::zeroed();
337
338            Ok(())
339        }
340    }
341
342    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DeviceSetBitrateResponse, ___E>
343        for &'a DeviceSetBitrateResponse
344    where
345        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
346    {
347        #[inline]
348        fn encode(
349            self,
350            encoder_: &mut ___E,
351            out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceSetBitrateResponse>,
352            _: (),
353        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
354            ::fidl_next::munge! {
355                let crate::wire::DeviceSetBitrateResponse {
356
357                        _empty,
358
359
360                } = out_;
361            }
362
363            Ok(())
364        }
365    }
366
367    unsafe impl<___E>
368        ::fidl_next::EncodeOption<
369            ::fidl_next::WireBox<'static, crate::wire::DeviceSetBitrateResponse>,
370            ___E,
371        > for DeviceSetBitrateResponse
372    where
373        ___E: ::fidl_next::Encoder + ?Sized,
374        DeviceSetBitrateResponse: ::fidl_next::Encode<crate::wire::DeviceSetBitrateResponse, ___E>,
375    {
376        #[inline]
377        fn encode_option(
378            this: ::core::option::Option<Self>,
379            encoder: &mut ___E,
380            out: &mut ::core::mem::MaybeUninit<
381                ::fidl_next::WireBox<'static, crate::wire::DeviceSetBitrateResponse>,
382            >,
383            _: (),
384        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
385            if let Some(inner) = this {
386                ::fidl_next::EncoderExt::encode_next(encoder, inner, ())?;
387                ::fidl_next::WireBox::encode_present(out);
388            } else {
389                ::fidl_next::WireBox::encode_absent(out);
390            }
391
392            Ok(())
393        }
394    }
395
396    unsafe impl<'a, ___E>
397        ::fidl_next::EncodeOption<
398            ::fidl_next::WireBox<'static, crate::wire::DeviceSetBitrateResponse>,
399            ___E,
400        > for &'a DeviceSetBitrateResponse
401    where
402        ___E: ::fidl_next::Encoder + ?Sized,
403        &'a DeviceSetBitrateResponse:
404            ::fidl_next::Encode<crate::wire::DeviceSetBitrateResponse, ___E>,
405    {
406        #[inline]
407        fn encode_option(
408            this: ::core::option::Option<Self>,
409            encoder: &mut ___E,
410            out: &mut ::core::mem::MaybeUninit<
411                ::fidl_next::WireBox<'static, crate::wire::DeviceSetBitrateResponse>,
412            >,
413            _: (),
414        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
415            if let Some(inner) = this {
416                ::fidl_next::EncoderExt::encode_next(encoder, inner, ())?;
417                ::fidl_next::WireBox::encode_present(out);
418            } else {
419                ::fidl_next::WireBox::encode_absent(out);
420            }
421
422            Ok(())
423        }
424    }
425
426    impl ::fidl_next::FromWire<crate::wire::DeviceSetBitrateResponse> for DeviceSetBitrateResponse {
427        const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
428            crate::wire::DeviceSetBitrateResponse,
429            Self,
430        > = unsafe { ::fidl_next::CopyOptimization::enable_if(true) };
431
432        #[inline]
433        fn from_wire(wire: crate::wire::DeviceSetBitrateResponse) -> Self {
434            Self {}
435        }
436    }
437
438    impl ::fidl_next::FromWireRef<crate::wire::DeviceSetBitrateResponse> for DeviceSetBitrateResponse {
439        #[inline]
440        fn from_wire_ref(wire: &crate::wire::DeviceSetBitrateResponse) -> Self {
441            Self {}
442        }
443    }
444
445    #[doc = " If `read_size` is set: This is a read operation and `read_size` bytes will be read.\n If `write_data` is set: This is a write operation and `write_data` will be written.\n"]
446    #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
447    pub enum I2cImplOpType {
448        ReadSize(u32),
449
450        WriteData(::std::vec::Vec<u8>),
451    }
452
453    unsafe impl<___E> ::fidl_next::Encode<crate::wire::I2cImplOpType<'static>, ___E> for I2cImplOpType
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::I2cImplOpType<'static>>,
463            _: (),
464        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
465            ::fidl_next::munge!(let crate::wire::I2cImplOpType { raw, _phantom: _ } = out);
466
467            match self {
468                Self::ReadSize(value) => ::fidl_next::RawWireUnion::encode_as::<
469                    ___E,
470                    ::fidl_next::WireU32,
471                >(value, 1, encoder, raw, ())?,
472
473                Self::WriteData(value) => ::fidl_next::RawWireUnion::encode_as::<
474                    ___E,
475                    ::fidl_next::WireVector<'static, u8>,
476                >(value, 2, encoder, raw, (32768, ()))?,
477            }
478
479            Ok(())
480        }
481    }
482
483    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::I2cImplOpType<'static>, ___E>
484        for &'a I2cImplOpType
485    where
486        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
487        ___E: ::fidl_next::Encoder,
488    {
489        #[inline]
490        fn encode(
491            self,
492            encoder: &mut ___E,
493            out: &mut ::core::mem::MaybeUninit<crate::wire::I2cImplOpType<'static>>,
494            _: (),
495        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
496            ::fidl_next::munge!(let crate::wire::I2cImplOpType { raw, _phantom: _ } = out);
497
498            match self {
499                I2cImplOpType::ReadSize(value) => ::fidl_next::RawWireUnion::encode_as::<
500                    ___E,
501                    ::fidl_next::WireU32,
502                >(value, 1, encoder, raw, ())?,
503
504                I2cImplOpType::WriteData(value) => {
505                    ::fidl_next::RawWireUnion::encode_as::<
506                        ___E,
507                        ::fidl_next::WireVector<'static, u8>,
508                    >(value, 2, encoder, raw, (32768, ()))?
509                }
510            }
511
512            Ok(())
513        }
514    }
515
516    unsafe impl<___E> ::fidl_next::EncodeOption<crate::wire_optional::I2cImplOpType<'static>, ___E>
517        for I2cImplOpType
518    where
519        ___E: ?Sized,
520        I2cImplOpType: ::fidl_next::Encode<crate::wire::I2cImplOpType<'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<crate::wire_optional::I2cImplOpType<'static>>,
527            _: (),
528        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
529            ::fidl_next::munge!(let crate::wire_optional::I2cImplOpType { raw, _phantom: _ } = &mut *out);
530
531            if let Some(inner) = this {
532                let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
533                ::fidl_next::Encode::encode(inner, encoder, value_out, ())?;
534            } else {
535                ::fidl_next::RawWireUnion::encode_absent(raw);
536            }
537
538            Ok(())
539        }
540    }
541
542    unsafe impl<'a, ___E>
543        ::fidl_next::EncodeOption<crate::wire_optional::I2cImplOpType<'static>, ___E>
544        for &'a I2cImplOpType
545    where
546        ___E: ?Sized,
547        &'a I2cImplOpType: ::fidl_next::Encode<crate::wire::I2cImplOpType<'static>, ___E>,
548    {
549        #[inline]
550        fn encode_option(
551            this: ::core::option::Option<Self>,
552            encoder: &mut ___E,
553            out: &mut ::core::mem::MaybeUninit<crate::wire_optional::I2cImplOpType<'static>>,
554            _: (),
555        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
556            ::fidl_next::munge!(let crate::wire_optional::I2cImplOpType { raw, _phantom: _ } = &mut *out);
557
558            if let Some(inner) = this {
559                let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
560                ::fidl_next::Encode::encode(inner, encoder, value_out, ())?;
561            } else {
562                ::fidl_next::RawWireUnion::encode_absent(raw);
563            }
564
565            Ok(())
566        }
567    }
568
569    impl<'de> ::fidl_next::FromWire<crate::wire::I2cImplOpType<'de>> for I2cImplOpType {
570        #[inline]
571        fn from_wire(wire: crate::wire::I2cImplOpType<'de>) -> Self {
572            let wire = ::core::mem::ManuallyDrop::new(wire);
573            match wire.raw.ordinal() {
574                1 => Self::ReadSize(::fidl_next::FromWire::from_wire(unsafe {
575                    wire.raw.get().read_unchecked::<::fidl_next::WireU32>()
576                })),
577
578                2 => Self::WriteData(::fidl_next::FromWire::from_wire(unsafe {
579                    wire.raw.get().read_unchecked::<::fidl_next::WireVector<'de, u8>>()
580                })),
581
582                _ => unsafe { ::core::hint::unreachable_unchecked() },
583            }
584        }
585    }
586
587    impl<'de> ::fidl_next::FromWireRef<crate::wire::I2cImplOpType<'de>> for I2cImplOpType {
588        #[inline]
589        fn from_wire_ref(wire: &crate::wire::I2cImplOpType<'de>) -> Self {
590            match wire.raw.ordinal() {
591                1 => Self::ReadSize(::fidl_next::FromWireRef::from_wire_ref(unsafe {
592                    wire.raw.get().deref_unchecked::<::fidl_next::WireU32>()
593                })),
594
595                2 => Self::WriteData(::fidl_next::FromWireRef::from_wire_ref(unsafe {
596                    wire.raw.get().deref_unchecked::<::fidl_next::WireVector<'de, u8>>()
597                })),
598
599                _ => unsafe { ::core::hint::unreachable_unchecked() },
600            }
601        }
602    }
603
604    impl<'de> ::fidl_next::FromWireOption<crate::wire_optional::I2cImplOpType<'de>> for I2cImplOpType {
605        #[inline]
606        fn from_wire_option(
607            wire: crate::wire_optional::I2cImplOpType<'de>,
608        ) -> ::core::option::Option<Self> {
609            if let Some(inner) = wire.into_option() {
610                Some(::fidl_next::FromWire::from_wire(inner))
611            } else {
612                None
613            }
614        }
615    }
616
617    impl<'de> ::fidl_next::FromWireOption<crate::wire_optional::I2cImplOpType<'de>>
618        for Box<I2cImplOpType>
619    {
620        #[inline]
621        fn from_wire_option(
622            wire: crate::wire_optional::I2cImplOpType<'de>,
623        ) -> ::core::option::Option<Self> {
624            <I2cImplOpType as ::fidl_next::FromWireOption<
625                crate::wire_optional::I2cImplOpType<'de>,
626            >>::from_wire_option(wire)
627            .map(Box::new)
628        }
629    }
630
631    impl<'de> ::fidl_next::FromWireOptionRef<crate::wire_optional::I2cImplOpType<'de>>
632        for Box<I2cImplOpType>
633    {
634        #[inline]
635        fn from_wire_option_ref(
636            wire: &crate::wire_optional::I2cImplOpType<'de>,
637        ) -> ::core::option::Option<Self> {
638            if let Some(inner) = wire.as_ref() {
639                Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner)))
640            } else {
641                None
642            }
643        }
644    }
645
646    #[doc = " See `Transact` below for usage.\n"]
647    #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
648    pub struct I2cImplOp {
649        pub address: u16,
650
651        pub type_: crate::natural::I2cImplOpType,
652
653        pub stop: bool,
654    }
655
656    unsafe impl<___E> ::fidl_next::Encode<crate::wire::I2cImplOp<'static>, ___E> for I2cImplOp
657    where
658        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
659        ___E: ::fidl_next::Encoder,
660    {
661        #[inline]
662        fn encode(
663            self,
664            encoder_: &mut ___E,
665            out_: &mut ::core::mem::MaybeUninit<crate::wire::I2cImplOp<'static>>,
666            _: (),
667        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
668            ::fidl_next::munge! {
669                let crate::wire::I2cImplOp {
670                    address,
671                    type_,
672                    stop,
673
674                } = out_;
675            }
676
677            ::fidl_next::Encode::encode(self.address, encoder_, address, ())?;
678
679            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(address.as_mut_ptr()) };
680
681            ::fidl_next::Encode::encode(self.type_, encoder_, type_, ())?;
682
683            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(type_.as_mut_ptr()) };
684
685            ::fidl_next::Encode::encode(self.stop, encoder_, stop, ())?;
686
687            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(stop.as_mut_ptr()) };
688
689            Ok(())
690        }
691    }
692
693    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::I2cImplOp<'static>, ___E> for &'a I2cImplOp
694    where
695        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
696        ___E: ::fidl_next::Encoder,
697    {
698        #[inline]
699        fn encode(
700            self,
701            encoder_: &mut ___E,
702            out_: &mut ::core::mem::MaybeUninit<crate::wire::I2cImplOp<'static>>,
703            _: (),
704        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
705            ::fidl_next::munge! {
706                let crate::wire::I2cImplOp {
707
708                    address,
709                    type_,
710                    stop,
711
712                } = out_;
713            }
714
715            ::fidl_next::Encode::encode(&self.address, encoder_, address, ())?;
716
717            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(address.as_mut_ptr()) };
718
719            ::fidl_next::Encode::encode(&self.type_, encoder_, type_, ())?;
720
721            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(type_.as_mut_ptr()) };
722
723            ::fidl_next::Encode::encode(&self.stop, encoder_, stop, ())?;
724
725            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(stop.as_mut_ptr()) };
726
727            Ok(())
728        }
729    }
730
731    unsafe impl<___E>
732        ::fidl_next::EncodeOption<
733            ::fidl_next::WireBox<'static, crate::wire::I2cImplOp<'static>>,
734            ___E,
735        > for I2cImplOp
736    where
737        ___E: ::fidl_next::Encoder + ?Sized,
738        I2cImplOp: ::fidl_next::Encode<crate::wire::I2cImplOp<'static>, ___E>,
739    {
740        #[inline]
741        fn encode_option(
742            this: ::core::option::Option<Self>,
743            encoder: &mut ___E,
744            out: &mut ::core::mem::MaybeUninit<
745                ::fidl_next::WireBox<'static, crate::wire::I2cImplOp<'static>>,
746            >,
747            _: (),
748        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
749            if let Some(inner) = this {
750                ::fidl_next::EncoderExt::encode_next(encoder, inner, ())?;
751                ::fidl_next::WireBox::encode_present(out);
752            } else {
753                ::fidl_next::WireBox::encode_absent(out);
754            }
755
756            Ok(())
757        }
758    }
759
760    unsafe impl<'a, ___E>
761        ::fidl_next::EncodeOption<
762            ::fidl_next::WireBox<'static, crate::wire::I2cImplOp<'static>>,
763            ___E,
764        > for &'a I2cImplOp
765    where
766        ___E: ::fidl_next::Encoder + ?Sized,
767        &'a I2cImplOp: ::fidl_next::Encode<crate::wire::I2cImplOp<'static>, ___E>,
768    {
769        #[inline]
770        fn encode_option(
771            this: ::core::option::Option<Self>,
772            encoder: &mut ___E,
773            out: &mut ::core::mem::MaybeUninit<
774                ::fidl_next::WireBox<'static, crate::wire::I2cImplOp<'static>>,
775            >,
776            _: (),
777        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
778            if let Some(inner) = this {
779                ::fidl_next::EncoderExt::encode_next(encoder, inner, ())?;
780                ::fidl_next::WireBox::encode_present(out);
781            } else {
782                ::fidl_next::WireBox::encode_absent(out);
783            }
784
785            Ok(())
786        }
787    }
788
789    impl<'de> ::fidl_next::FromWire<crate::wire::I2cImplOp<'de>> for I2cImplOp {
790        #[inline]
791        fn from_wire(wire: crate::wire::I2cImplOp<'de>) -> Self {
792            Self {
793                address: ::fidl_next::FromWire::from_wire(wire.address),
794
795                type_: ::fidl_next::FromWire::from_wire(wire.type_),
796
797                stop: ::fidl_next::FromWire::from_wire(wire.stop),
798            }
799        }
800    }
801
802    impl<'de> ::fidl_next::FromWireRef<crate::wire::I2cImplOp<'de>> for I2cImplOp {
803        #[inline]
804        fn from_wire_ref(wire: &crate::wire::I2cImplOp<'de>) -> Self {
805            Self {
806                address: ::fidl_next::FromWireRef::from_wire_ref(&wire.address),
807
808                type_: ::fidl_next::FromWireRef::from_wire_ref(&wire.type_),
809
810                stop: ::fidl_next::FromWireRef::from_wire_ref(&wire.stop),
811            }
812        }
813    }
814
815    #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
816    pub struct DeviceTransactRequest {
817        pub op: ::std::vec::Vec<crate::natural::I2cImplOp>,
818    }
819
820    unsafe impl<___E> ::fidl_next::Encode<crate::wire::DeviceTransactRequest<'static>, ___E>
821        for DeviceTransactRequest
822    where
823        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
824        ___E: ::fidl_next::Encoder,
825    {
826        #[inline]
827        fn encode(
828            self,
829            encoder_: &mut ___E,
830            out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceTransactRequest<'static>>,
831            _: (),
832        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
833            ::fidl_next::munge! {
834                let crate::wire::DeviceTransactRequest {
835                    op,
836
837                } = out_;
838            }
839
840            ::fidl_next::Encode::encode(self.op, encoder_, op, (256, ()))?;
841
842            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(op.as_mut_ptr()) };
843            ::fidl_next::Constrained::validate(_field, (256, ()))?;
844
845            Ok(())
846        }
847    }
848
849    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DeviceTransactRequest<'static>, ___E>
850        for &'a DeviceTransactRequest
851    where
852        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
853        ___E: ::fidl_next::Encoder,
854    {
855        #[inline]
856        fn encode(
857            self,
858            encoder_: &mut ___E,
859            out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceTransactRequest<'static>>,
860            _: (),
861        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
862            ::fidl_next::munge! {
863                let crate::wire::DeviceTransactRequest {
864
865                    op,
866
867                } = out_;
868            }
869
870            ::fidl_next::Encode::encode(&self.op, encoder_, op, (256, ()))?;
871
872            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(op.as_mut_ptr()) };
873            ::fidl_next::Constrained::validate(_field, (256, ()))?;
874
875            Ok(())
876        }
877    }
878
879    unsafe impl<___E>
880        ::fidl_next::EncodeOption<
881            ::fidl_next::WireBox<'static, crate::wire::DeviceTransactRequest<'static>>,
882            ___E,
883        > for DeviceTransactRequest
884    where
885        ___E: ::fidl_next::Encoder + ?Sized,
886        DeviceTransactRequest:
887            ::fidl_next::Encode<crate::wire::DeviceTransactRequest<'static>, ___E>,
888    {
889        #[inline]
890        fn encode_option(
891            this: ::core::option::Option<Self>,
892            encoder: &mut ___E,
893            out: &mut ::core::mem::MaybeUninit<
894                ::fidl_next::WireBox<'static, crate::wire::DeviceTransactRequest<'static>>,
895            >,
896            _: (),
897        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
898            if let Some(inner) = this {
899                ::fidl_next::EncoderExt::encode_next(encoder, inner, ())?;
900                ::fidl_next::WireBox::encode_present(out);
901            } else {
902                ::fidl_next::WireBox::encode_absent(out);
903            }
904
905            Ok(())
906        }
907    }
908
909    unsafe impl<'a, ___E>
910        ::fidl_next::EncodeOption<
911            ::fidl_next::WireBox<'static, crate::wire::DeviceTransactRequest<'static>>,
912            ___E,
913        > for &'a DeviceTransactRequest
914    where
915        ___E: ::fidl_next::Encoder + ?Sized,
916        &'a DeviceTransactRequest:
917            ::fidl_next::Encode<crate::wire::DeviceTransactRequest<'static>, ___E>,
918    {
919        #[inline]
920        fn encode_option(
921            this: ::core::option::Option<Self>,
922            encoder: &mut ___E,
923            out: &mut ::core::mem::MaybeUninit<
924                ::fidl_next::WireBox<'static, crate::wire::DeviceTransactRequest<'static>>,
925            >,
926            _: (),
927        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
928            if let Some(inner) = this {
929                ::fidl_next::EncoderExt::encode_next(encoder, inner, ())?;
930                ::fidl_next::WireBox::encode_present(out);
931            } else {
932                ::fidl_next::WireBox::encode_absent(out);
933            }
934
935            Ok(())
936        }
937    }
938
939    impl<'de> ::fidl_next::FromWire<crate::wire::DeviceTransactRequest<'de>> for DeviceTransactRequest {
940        #[inline]
941        fn from_wire(wire: crate::wire::DeviceTransactRequest<'de>) -> Self {
942            Self { op: ::fidl_next::FromWire::from_wire(wire.op) }
943        }
944    }
945
946    impl<'de> ::fidl_next::FromWireRef<crate::wire::DeviceTransactRequest<'de>>
947        for DeviceTransactRequest
948    {
949        #[inline]
950        fn from_wire_ref(wire: &crate::wire::DeviceTransactRequest<'de>) -> Self {
951            Self { op: ::fidl_next::FromWireRef::from_wire_ref(&wire.op) }
952        }
953    }
954
955    #[doc = " The result of one read transaction.\n"]
956    #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
957    pub struct ReadData {
958        pub data: ::std::vec::Vec<u8>,
959    }
960
961    unsafe impl<___E> ::fidl_next::Encode<crate::wire::ReadData<'static>, ___E> for ReadData
962    where
963        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
964        ___E: ::fidl_next::Encoder,
965    {
966        #[inline]
967        fn encode(
968            self,
969            encoder_: &mut ___E,
970            out_: &mut ::core::mem::MaybeUninit<crate::wire::ReadData<'static>>,
971            _: (),
972        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
973            ::fidl_next::munge! {
974                let crate::wire::ReadData {
975                    data,
976
977                } = out_;
978            }
979
980            ::fidl_next::Encode::encode(self.data, encoder_, data, (32768, ()))?;
981
982            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(data.as_mut_ptr()) };
983            ::fidl_next::Constrained::validate(_field, (32768, ()))?;
984
985            Ok(())
986        }
987    }
988
989    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::ReadData<'static>, ___E> for &'a ReadData
990    where
991        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
992        ___E: ::fidl_next::Encoder,
993    {
994        #[inline]
995        fn encode(
996            self,
997            encoder_: &mut ___E,
998            out_: &mut ::core::mem::MaybeUninit<crate::wire::ReadData<'static>>,
999            _: (),
1000        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1001            ::fidl_next::munge! {
1002                let crate::wire::ReadData {
1003
1004                    data,
1005
1006                } = out_;
1007            }
1008
1009            ::fidl_next::Encode::encode(&self.data, encoder_, data, (32768, ()))?;
1010
1011            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(data.as_mut_ptr()) };
1012            ::fidl_next::Constrained::validate(_field, (32768, ()))?;
1013
1014            Ok(())
1015        }
1016    }
1017
1018    unsafe impl<___E>
1019        ::fidl_next::EncodeOption<
1020            ::fidl_next::WireBox<'static, crate::wire::ReadData<'static>>,
1021            ___E,
1022        > for ReadData
1023    where
1024        ___E: ::fidl_next::Encoder + ?Sized,
1025        ReadData: ::fidl_next::Encode<crate::wire::ReadData<'static>, ___E>,
1026    {
1027        #[inline]
1028        fn encode_option(
1029            this: ::core::option::Option<Self>,
1030            encoder: &mut ___E,
1031            out: &mut ::core::mem::MaybeUninit<
1032                ::fidl_next::WireBox<'static, crate::wire::ReadData<'static>>,
1033            >,
1034            _: (),
1035        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1036            if let Some(inner) = this {
1037                ::fidl_next::EncoderExt::encode_next(encoder, inner, ())?;
1038                ::fidl_next::WireBox::encode_present(out);
1039            } else {
1040                ::fidl_next::WireBox::encode_absent(out);
1041            }
1042
1043            Ok(())
1044        }
1045    }
1046
1047    unsafe impl<'a, ___E>
1048        ::fidl_next::EncodeOption<
1049            ::fidl_next::WireBox<'static, crate::wire::ReadData<'static>>,
1050            ___E,
1051        > for &'a ReadData
1052    where
1053        ___E: ::fidl_next::Encoder + ?Sized,
1054        &'a ReadData: ::fidl_next::Encode<crate::wire::ReadData<'static>, ___E>,
1055    {
1056        #[inline]
1057        fn encode_option(
1058            this: ::core::option::Option<Self>,
1059            encoder: &mut ___E,
1060            out: &mut ::core::mem::MaybeUninit<
1061                ::fidl_next::WireBox<'static, crate::wire::ReadData<'static>>,
1062            >,
1063            _: (),
1064        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1065            if let Some(inner) = this {
1066                ::fidl_next::EncoderExt::encode_next(encoder, inner, ())?;
1067                ::fidl_next::WireBox::encode_present(out);
1068            } else {
1069                ::fidl_next::WireBox::encode_absent(out);
1070            }
1071
1072            Ok(())
1073        }
1074    }
1075
1076    impl<'de> ::fidl_next::FromWire<crate::wire::ReadData<'de>> for ReadData {
1077        #[inline]
1078        fn from_wire(wire: crate::wire::ReadData<'de>) -> Self {
1079            Self { data: ::fidl_next::FromWire::from_wire(wire.data) }
1080        }
1081    }
1082
1083    impl<'de> ::fidl_next::FromWireRef<crate::wire::ReadData<'de>> for ReadData {
1084        #[inline]
1085        fn from_wire_ref(wire: &crate::wire::ReadData<'de>) -> Self {
1086            Self { data: ::fidl_next::FromWireRef::from_wire_ref(&wire.data) }
1087        }
1088    }
1089
1090    #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
1091    pub struct DeviceTransactResponse {
1092        pub read: ::std::vec::Vec<crate::natural::ReadData>,
1093    }
1094
1095    unsafe impl<___E> ::fidl_next::Encode<crate::wire::DeviceTransactResponse<'static>, ___E>
1096        for DeviceTransactResponse
1097    where
1098        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1099        ___E: ::fidl_next::Encoder,
1100    {
1101        #[inline]
1102        fn encode(
1103            self,
1104            encoder_: &mut ___E,
1105            out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceTransactResponse<'static>>,
1106            _: (),
1107        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1108            ::fidl_next::munge! {
1109                let crate::wire::DeviceTransactResponse {
1110                    read,
1111
1112                } = out_;
1113            }
1114
1115            ::fidl_next::Encode::encode(self.read, encoder_, read, (256, ()))?;
1116
1117            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(read.as_mut_ptr()) };
1118            ::fidl_next::Constrained::validate(_field, (256, ()))?;
1119
1120            Ok(())
1121        }
1122    }
1123
1124    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DeviceTransactResponse<'static>, ___E>
1125        for &'a DeviceTransactResponse
1126    where
1127        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1128        ___E: ::fidl_next::Encoder,
1129    {
1130        #[inline]
1131        fn encode(
1132            self,
1133            encoder_: &mut ___E,
1134            out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceTransactResponse<'static>>,
1135            _: (),
1136        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1137            ::fidl_next::munge! {
1138                let crate::wire::DeviceTransactResponse {
1139
1140                    read,
1141
1142                } = out_;
1143            }
1144
1145            ::fidl_next::Encode::encode(&self.read, encoder_, read, (256, ()))?;
1146
1147            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(read.as_mut_ptr()) };
1148            ::fidl_next::Constrained::validate(_field, (256, ()))?;
1149
1150            Ok(())
1151        }
1152    }
1153
1154    unsafe impl<___E>
1155        ::fidl_next::EncodeOption<
1156            ::fidl_next::WireBox<'static, crate::wire::DeviceTransactResponse<'static>>,
1157            ___E,
1158        > for DeviceTransactResponse
1159    where
1160        ___E: ::fidl_next::Encoder + ?Sized,
1161        DeviceTransactResponse:
1162            ::fidl_next::Encode<crate::wire::DeviceTransactResponse<'static>, ___E>,
1163    {
1164        #[inline]
1165        fn encode_option(
1166            this: ::core::option::Option<Self>,
1167            encoder: &mut ___E,
1168            out: &mut ::core::mem::MaybeUninit<
1169                ::fidl_next::WireBox<'static, crate::wire::DeviceTransactResponse<'static>>,
1170            >,
1171            _: (),
1172        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1173            if let Some(inner) = this {
1174                ::fidl_next::EncoderExt::encode_next(encoder, inner, ())?;
1175                ::fidl_next::WireBox::encode_present(out);
1176            } else {
1177                ::fidl_next::WireBox::encode_absent(out);
1178            }
1179
1180            Ok(())
1181        }
1182    }
1183
1184    unsafe impl<'a, ___E>
1185        ::fidl_next::EncodeOption<
1186            ::fidl_next::WireBox<'static, crate::wire::DeviceTransactResponse<'static>>,
1187            ___E,
1188        > for &'a DeviceTransactResponse
1189    where
1190        ___E: ::fidl_next::Encoder + ?Sized,
1191        &'a DeviceTransactResponse:
1192            ::fidl_next::Encode<crate::wire::DeviceTransactResponse<'static>, ___E>,
1193    {
1194        #[inline]
1195        fn encode_option(
1196            this: ::core::option::Option<Self>,
1197            encoder: &mut ___E,
1198            out: &mut ::core::mem::MaybeUninit<
1199                ::fidl_next::WireBox<'static, crate::wire::DeviceTransactResponse<'static>>,
1200            >,
1201            _: (),
1202        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1203            if let Some(inner) = this {
1204                ::fidl_next::EncoderExt::encode_next(encoder, inner, ())?;
1205                ::fidl_next::WireBox::encode_present(out);
1206            } else {
1207                ::fidl_next::WireBox::encode_absent(out);
1208            }
1209
1210            Ok(())
1211        }
1212    }
1213
1214    impl<'de> ::fidl_next::FromWire<crate::wire::DeviceTransactResponse<'de>>
1215        for DeviceTransactResponse
1216    {
1217        #[inline]
1218        fn from_wire(wire: crate::wire::DeviceTransactResponse<'de>) -> Self {
1219            Self { read: ::fidl_next::FromWire::from_wire(wire.read) }
1220        }
1221    }
1222
1223    impl<'de> ::fidl_next::FromWireRef<crate::wire::DeviceTransactResponse<'de>>
1224        for DeviceTransactResponse
1225    {
1226        #[inline]
1227        fn from_wire_ref(wire: &crate::wire::DeviceTransactResponse<'de>) -> Self {
1228            Self { read: ::fidl_next::FromWireRef::from_wire_ref(&wire.read) }
1229        }
1230    }
1231}
1232
1233pub mod wire {
1234
1235    /// The wire type corresponding to [`DeviceGetMaxTransferSizeResponse`].
1236    #[derive(Clone, Debug)]
1237    #[repr(C)]
1238    pub struct DeviceGetMaxTransferSizeResponse {
1239        pub size: ::fidl_next::WireU64,
1240    }
1241
1242    static_assertions::const_assert_eq!(std::mem::size_of::<DeviceGetMaxTransferSizeResponse>(), 8);
1243    static_assertions::const_assert_eq!(
1244        std::mem::align_of::<DeviceGetMaxTransferSizeResponse>(),
1245        8
1246    );
1247
1248    static_assertions::const_assert_eq!(
1249        std::mem::offset_of!(DeviceGetMaxTransferSizeResponse, size),
1250        0
1251    );
1252
1253    unsafe impl ::fidl_next::Wire for DeviceGetMaxTransferSizeResponse {
1254        type Owned<'de> = DeviceGetMaxTransferSizeResponse;
1255
1256        #[inline]
1257        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1258            ::fidl_next::munge! {
1259                let Self {
1260
1261                    size,
1262
1263                } = &mut *out_;
1264            }
1265
1266            ::fidl_next::Wire::zero_padding(size);
1267        }
1268    }
1269
1270    unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceGetMaxTransferSizeResponse
1271    where
1272        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1273    {
1274        fn decode(
1275            slot_: ::fidl_next::Slot<'_, Self>,
1276            decoder_: &mut ___D,
1277            _: (),
1278        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1279            ::fidl_next::munge! {
1280                let Self {
1281
1282                    mut size,
1283
1284                } = slot_;
1285            }
1286
1287            let _field = size.as_mut();
1288
1289            ::fidl_next::Decode::decode(size.as_mut(), decoder_, ())?;
1290
1291            Ok(())
1292        }
1293    }
1294
1295    impl ::fidl_next::IntoNatural for DeviceGetMaxTransferSizeResponse {
1296        type Natural = crate::natural::DeviceGetMaxTransferSizeResponse;
1297    }
1298
1299    impl ::fidl_next::Unconstrained for DeviceGetMaxTransferSizeResponse {}
1300
1301    /// The wire type corresponding to [`DeviceSetBitrateRequest`].
1302    #[derive(Clone, Debug)]
1303    #[repr(C)]
1304    pub struct DeviceSetBitrateRequest {
1305        pub bitrate: ::fidl_next::WireU32,
1306    }
1307
1308    static_assertions::const_assert_eq!(std::mem::size_of::<DeviceSetBitrateRequest>(), 4);
1309    static_assertions::const_assert_eq!(std::mem::align_of::<DeviceSetBitrateRequest>(), 4);
1310
1311    static_assertions::const_assert_eq!(std::mem::offset_of!(DeviceSetBitrateRequest, bitrate), 0);
1312
1313    unsafe impl ::fidl_next::Wire for DeviceSetBitrateRequest {
1314        type Owned<'de> = DeviceSetBitrateRequest;
1315
1316        #[inline]
1317        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1318            ::fidl_next::munge! {
1319                let Self {
1320
1321                    bitrate,
1322
1323                } = &mut *out_;
1324            }
1325
1326            ::fidl_next::Wire::zero_padding(bitrate);
1327        }
1328    }
1329
1330    unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceSetBitrateRequest
1331    where
1332        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1333    {
1334        fn decode(
1335            slot_: ::fidl_next::Slot<'_, Self>,
1336            decoder_: &mut ___D,
1337            _: (),
1338        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1339            ::fidl_next::munge! {
1340                let Self {
1341
1342                    mut bitrate,
1343
1344                } = slot_;
1345            }
1346
1347            let _field = bitrate.as_mut();
1348
1349            ::fidl_next::Decode::decode(bitrate.as_mut(), decoder_, ())?;
1350
1351            Ok(())
1352        }
1353    }
1354
1355    impl ::fidl_next::IntoNatural for DeviceSetBitrateRequest {
1356        type Natural = crate::natural::DeviceSetBitrateRequest;
1357    }
1358
1359    impl ::fidl_next::Unconstrained for DeviceSetBitrateRequest {}
1360
1361    /// The wire type corresponding to [`DeviceSetBitrateResponse`].
1362    #[derive(Clone, Debug)]
1363    #[repr(C)]
1364    pub struct DeviceSetBitrateResponse {
1365        pub(crate) _empty: fidl_next::WireEmptyStructPlaceholder,
1366    }
1367
1368    static_assertions::const_assert_eq!(std::mem::size_of::<DeviceSetBitrateResponse>(), 1);
1369    static_assertions::const_assert_eq!(std::mem::align_of::<DeviceSetBitrateResponse>(), 1);
1370
1371    unsafe impl ::fidl_next::Wire for DeviceSetBitrateResponse {
1372        type Owned<'de> = DeviceSetBitrateResponse;
1373
1374        #[inline]
1375        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1376            ::fidl_next::munge! {
1377                let Self {
1378
1379                        _empty,
1380
1381
1382                } = &mut *out_;
1383            }
1384        }
1385    }
1386
1387    unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceSetBitrateResponse
1388    where
1389        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1390    {
1391        fn decode(
1392            slot_: ::fidl_next::Slot<'_, Self>,
1393            decoder_: &mut ___D,
1394            _: (),
1395        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1396            ::fidl_next::munge! {
1397                let Self {
1398
1399                        mut _empty,
1400
1401
1402                } = slot_;
1403            }
1404
1405            if _empty.as_bytes() != &[0u8] {
1406                return Err(::fidl_next::DecodeError::InvalidEmptyStruct);
1407            }
1408
1409            Ok(())
1410        }
1411    }
1412
1413    impl ::fidl_next::IntoNatural for DeviceSetBitrateResponse {
1414        type Natural = crate::natural::DeviceSetBitrateResponse;
1415    }
1416
1417    impl ::fidl_next::Unconstrained for DeviceSetBitrateResponse {}
1418
1419    /// The wire type corresponding to [`I2cImplOpType`].
1420    #[repr(transparent)]
1421    pub struct I2cImplOpType<'de> {
1422        pub(crate) raw: ::fidl_next::RawWireUnion,
1423        pub(crate) _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
1424    }
1425
1426    impl<'de> Drop for I2cImplOpType<'de> {
1427        fn drop(&mut self) {
1428            match self.raw.ordinal() {
1429                1 => {
1430                    let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireU32>() };
1431                }
1432
1433                2 => {
1434                    let _ = unsafe {
1435                        self.raw.get().read_unchecked::<::fidl_next::WireVector<'de, u8>>()
1436                    };
1437                }
1438
1439                _ => unsafe { ::core::hint::unreachable_unchecked() },
1440            }
1441        }
1442    }
1443
1444    unsafe impl ::fidl_next::Wire for I2cImplOpType<'static> {
1445        type Owned<'de> = I2cImplOpType<'de>;
1446
1447        #[inline]
1448        fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
1449            ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
1450            ::fidl_next::RawWireUnion::zero_padding(raw);
1451        }
1452    }
1453
1454    pub mod i2c_impl_op_type {
1455        pub enum Ref<'de> {
1456            ReadSize(&'de ::fidl_next::WireU32),
1457
1458            WriteData(&'de ::fidl_next::WireVector<'de, u8>),
1459        }
1460    }
1461
1462    impl<'de> I2cImplOpType<'de> {
1463        pub fn as_ref(&self) -> crate::wire::i2c_impl_op_type::Ref<'_> {
1464            match self.raw.ordinal() {
1465                1 => crate::wire::i2c_impl_op_type::Ref::ReadSize(unsafe {
1466                    self.raw.get().deref_unchecked::<::fidl_next::WireU32>()
1467                }),
1468
1469                2 => crate::wire::i2c_impl_op_type::Ref::WriteData(unsafe {
1470                    self.raw.get().deref_unchecked::<::fidl_next::WireVector<'_, u8>>()
1471                }),
1472
1473                _ => unsafe { ::core::hint::unreachable_unchecked() },
1474            }
1475        }
1476    }
1477
1478    unsafe impl<___D> ::fidl_next::Decode<___D> for I2cImplOpType<'static>
1479    where
1480        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1481        ___D: ::fidl_next::Decoder,
1482    {
1483        fn decode(
1484            mut slot: ::fidl_next::Slot<'_, Self>,
1485            decoder: &mut ___D,
1486            _: (),
1487        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1488            ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
1489            match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
1490                1 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireU32>(
1491                    raw,
1492                    decoder,
1493                    (),
1494                )?,
1495
1496                2 => ::fidl_next::RawWireUnion::decode_as::<
1497                    ___D,
1498                    ::fidl_next::WireVector<'static, u8>,
1499                >(raw, decoder, (32768, ()))?,
1500
1501                ord => return Err(::fidl_next::DecodeError::InvalidUnionOrdinal(ord as usize)),
1502            }
1503
1504            Ok(())
1505        }
1506    }
1507
1508    impl<'de> ::core::fmt::Debug for I2cImplOpType<'de> {
1509        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1510            match self.raw.ordinal() {
1511                1 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireU32>().fmt(f) },
1512                2 => unsafe {
1513                    self.raw.get().deref_unchecked::<::fidl_next::WireVector<'_, u8>>().fmt(f)
1514                },
1515                _ => unsafe { ::core::hint::unreachable_unchecked() },
1516            }
1517        }
1518    }
1519
1520    impl<'de> ::fidl_next::IntoNatural for I2cImplOpType<'de> {
1521        type Natural = crate::natural::I2cImplOpType;
1522    }
1523
1524    impl ::fidl_next::Unconstrained for I2cImplOpType<'static> {}
1525
1526    /// The wire type corresponding to [`I2cImplOp`].
1527    #[derive(Debug)]
1528    #[repr(C)]
1529    pub struct I2cImplOp<'de> {
1530        pub address: ::fidl_next::WireU16,
1531
1532        pub type_: crate::wire::I2cImplOpType<'de>,
1533
1534        pub stop: bool,
1535    }
1536
1537    static_assertions::const_assert_eq!(std::mem::size_of::<I2cImplOp<'_>>(), 32);
1538    static_assertions::const_assert_eq!(std::mem::align_of::<I2cImplOp<'_>>(), 8);
1539
1540    static_assertions::const_assert_eq!(std::mem::offset_of!(I2cImplOp<'_>, address), 0);
1541
1542    static_assertions::const_assert_eq!(std::mem::offset_of!(I2cImplOp<'_>, type_), 8);
1543
1544    static_assertions::const_assert_eq!(std::mem::offset_of!(I2cImplOp<'_>, stop), 24);
1545
1546    unsafe impl ::fidl_next::Wire for I2cImplOp<'static> {
1547        type Owned<'de> = I2cImplOp<'de>;
1548
1549        #[inline]
1550        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1551            ::fidl_next::munge! {
1552                let Self {
1553
1554                    address,
1555                    type_,
1556                    stop,
1557
1558                } = &mut *out_;
1559            }
1560
1561            ::fidl_next::Wire::zero_padding(address);
1562
1563            ::fidl_next::Wire::zero_padding(type_);
1564
1565            ::fidl_next::Wire::zero_padding(stop);
1566
1567            unsafe {
1568                out_.as_mut_ptr().cast::<u8>().add(25).write_bytes(0, 7);
1569            }
1570
1571            unsafe {
1572                out_.as_mut_ptr().cast::<u8>().add(2).write_bytes(0, 6);
1573            }
1574        }
1575    }
1576
1577    unsafe impl<___D> ::fidl_next::Decode<___D> for I2cImplOp<'static>
1578    where
1579        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1580        ___D: ::fidl_next::Decoder,
1581    {
1582        fn decode(
1583            slot_: ::fidl_next::Slot<'_, Self>,
1584            decoder_: &mut ___D,
1585            _: (),
1586        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1587            if slot_.as_bytes()[25..32] != [0u8; 7] {
1588                return Err(::fidl_next::DecodeError::InvalidPadding);
1589            }
1590
1591            if slot_.as_bytes()[2..8] != [0u8; 6] {
1592                return Err(::fidl_next::DecodeError::InvalidPadding);
1593            }
1594
1595            ::fidl_next::munge! {
1596                let Self {
1597
1598                    mut address,
1599                    mut type_,
1600                    mut stop,
1601
1602                } = slot_;
1603            }
1604
1605            let _field = address.as_mut();
1606
1607            ::fidl_next::Decode::decode(address.as_mut(), decoder_, ())?;
1608
1609            let _field = type_.as_mut();
1610
1611            ::fidl_next::Decode::decode(type_.as_mut(), decoder_, ())?;
1612
1613            let _field = stop.as_mut();
1614
1615            ::fidl_next::Decode::decode(stop.as_mut(), decoder_, ())?;
1616
1617            Ok(())
1618        }
1619    }
1620
1621    impl<'de> ::fidl_next::IntoNatural for I2cImplOp<'de> {
1622        type Natural = crate::natural::I2cImplOp;
1623    }
1624
1625    impl ::fidl_next::Unconstrained for I2cImplOp<'static> {}
1626
1627    /// The wire type corresponding to [`DeviceTransactRequest`].
1628    #[derive(Debug)]
1629    #[repr(C)]
1630    pub struct DeviceTransactRequest<'de> {
1631        pub op: ::fidl_next::WireVector<'de, crate::wire::I2cImplOp<'de>>,
1632    }
1633
1634    static_assertions::const_assert_eq!(std::mem::size_of::<DeviceTransactRequest<'_>>(), 16);
1635    static_assertions::const_assert_eq!(std::mem::align_of::<DeviceTransactRequest<'_>>(), 8);
1636
1637    static_assertions::const_assert_eq!(std::mem::offset_of!(DeviceTransactRequest<'_>, op), 0);
1638
1639    unsafe impl ::fidl_next::Wire for DeviceTransactRequest<'static> {
1640        type Owned<'de> = DeviceTransactRequest<'de>;
1641
1642        #[inline]
1643        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1644            ::fidl_next::munge! {
1645                let Self {
1646
1647                    op,
1648
1649                } = &mut *out_;
1650            }
1651
1652            ::fidl_next::Wire::zero_padding(op);
1653        }
1654    }
1655
1656    unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceTransactRequest<'static>
1657    where
1658        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1659        ___D: ::fidl_next::Decoder,
1660    {
1661        fn decode(
1662            slot_: ::fidl_next::Slot<'_, Self>,
1663            decoder_: &mut ___D,
1664            _: (),
1665        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1666            ::fidl_next::munge! {
1667                let Self {
1668
1669                    mut op,
1670
1671                } = slot_;
1672            }
1673
1674            let _field = op.as_mut();
1675            ::fidl_next::Constrained::validate(_field, (256, ()))?;
1676            ::fidl_next::Decode::decode(op.as_mut(), decoder_, (256, ()))?;
1677
1678            let op = unsafe { op.deref_unchecked() };
1679
1680            if op.len() > 256 {
1681                return Err(::fidl_next::DecodeError::VectorTooLong {
1682                    size: op.len() as u64,
1683                    limit: 256,
1684                });
1685            }
1686
1687            Ok(())
1688        }
1689    }
1690
1691    impl<'de> ::fidl_next::IntoNatural for DeviceTransactRequest<'de> {
1692        type Natural = crate::natural::DeviceTransactRequest;
1693    }
1694
1695    impl ::fidl_next::Unconstrained for DeviceTransactRequest<'static> {}
1696
1697    /// The wire type corresponding to [`ReadData`].
1698    #[derive(Debug)]
1699    #[repr(C)]
1700    pub struct ReadData<'de> {
1701        pub data: ::fidl_next::WireVector<'de, u8>,
1702    }
1703
1704    static_assertions::const_assert_eq!(std::mem::size_of::<ReadData<'_>>(), 16);
1705    static_assertions::const_assert_eq!(std::mem::align_of::<ReadData<'_>>(), 8);
1706
1707    static_assertions::const_assert_eq!(std::mem::offset_of!(ReadData<'_>, data), 0);
1708
1709    unsafe impl ::fidl_next::Wire for ReadData<'static> {
1710        type Owned<'de> = ReadData<'de>;
1711
1712        #[inline]
1713        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1714            ::fidl_next::munge! {
1715                let Self {
1716
1717                    data,
1718
1719                } = &mut *out_;
1720            }
1721
1722            ::fidl_next::Wire::zero_padding(data);
1723        }
1724    }
1725
1726    unsafe impl<___D> ::fidl_next::Decode<___D> for ReadData<'static>
1727    where
1728        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1729        ___D: ::fidl_next::Decoder,
1730    {
1731        fn decode(
1732            slot_: ::fidl_next::Slot<'_, Self>,
1733            decoder_: &mut ___D,
1734            _: (),
1735        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1736            ::fidl_next::munge! {
1737                let Self {
1738
1739                    mut data,
1740
1741                } = slot_;
1742            }
1743
1744            let _field = data.as_mut();
1745            ::fidl_next::Constrained::validate(_field, (32768, ()))?;
1746            ::fidl_next::Decode::decode(data.as_mut(), decoder_, (32768, ()))?;
1747
1748            let data = unsafe { data.deref_unchecked() };
1749
1750            if data.len() > 32768 {
1751                return Err(::fidl_next::DecodeError::VectorTooLong {
1752                    size: data.len() as u64,
1753                    limit: 32768,
1754                });
1755            }
1756
1757            Ok(())
1758        }
1759    }
1760
1761    impl<'de> ::fidl_next::IntoNatural for ReadData<'de> {
1762        type Natural = crate::natural::ReadData;
1763    }
1764
1765    impl ::fidl_next::Unconstrained for ReadData<'static> {}
1766
1767    /// The wire type corresponding to [`DeviceTransactResponse`].
1768    #[derive(Debug)]
1769    #[repr(C)]
1770    pub struct DeviceTransactResponse<'de> {
1771        pub read: ::fidl_next::WireVector<'de, crate::wire::ReadData<'de>>,
1772    }
1773
1774    static_assertions::const_assert_eq!(std::mem::size_of::<DeviceTransactResponse<'_>>(), 16);
1775    static_assertions::const_assert_eq!(std::mem::align_of::<DeviceTransactResponse<'_>>(), 8);
1776
1777    static_assertions::const_assert_eq!(std::mem::offset_of!(DeviceTransactResponse<'_>, read), 0);
1778
1779    unsafe impl ::fidl_next::Wire for DeviceTransactResponse<'static> {
1780        type Owned<'de> = DeviceTransactResponse<'de>;
1781
1782        #[inline]
1783        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1784            ::fidl_next::munge! {
1785                let Self {
1786
1787                    read,
1788
1789                } = &mut *out_;
1790            }
1791
1792            ::fidl_next::Wire::zero_padding(read);
1793        }
1794    }
1795
1796    unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceTransactResponse<'static>
1797    where
1798        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1799        ___D: ::fidl_next::Decoder,
1800    {
1801        fn decode(
1802            slot_: ::fidl_next::Slot<'_, Self>,
1803            decoder_: &mut ___D,
1804            _: (),
1805        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1806            ::fidl_next::munge! {
1807                let Self {
1808
1809                    mut read,
1810
1811                } = slot_;
1812            }
1813
1814            let _field = read.as_mut();
1815            ::fidl_next::Constrained::validate(_field, (256, ()))?;
1816            ::fidl_next::Decode::decode(read.as_mut(), decoder_, (256, ()))?;
1817
1818            let read = unsafe { read.deref_unchecked() };
1819
1820            if read.len() > 256 {
1821                return Err(::fidl_next::DecodeError::VectorTooLong {
1822                    size: read.len() as u64,
1823                    limit: 256,
1824                });
1825            }
1826
1827            Ok(())
1828        }
1829    }
1830
1831    impl<'de> ::fidl_next::IntoNatural for DeviceTransactResponse<'de> {
1832        type Natural = crate::natural::DeviceTransactResponse;
1833    }
1834
1835    impl ::fidl_next::Unconstrained for DeviceTransactResponse<'static> {}
1836}
1837
1838pub mod wire_optional {
1839
1840    #[repr(transparent)]
1841    pub struct I2cImplOpType<'de> {
1842        pub(crate) raw: ::fidl_next::RawWireUnion,
1843        pub(crate) _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
1844    }
1845
1846    unsafe impl ::fidl_next::Wire for I2cImplOpType<'static> {
1847        type Owned<'de> = I2cImplOpType<'de>;
1848
1849        #[inline]
1850        fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
1851            ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
1852            ::fidl_next::RawWireUnion::zero_padding(raw);
1853        }
1854    }
1855
1856    impl<'de> I2cImplOpType<'de> {
1857        pub fn is_some(&self) -> bool {
1858            self.raw.is_some()
1859        }
1860
1861        pub fn is_none(&self) -> bool {
1862            self.raw.is_none()
1863        }
1864
1865        pub fn as_ref(&self) -> ::core::option::Option<&crate::wire::I2cImplOpType<'de>> {
1866            if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None }
1867        }
1868
1869        pub fn into_option(self) -> ::core::option::Option<crate::wire::I2cImplOpType<'de>> {
1870            if self.is_some() {
1871                Some(crate::wire::I2cImplOpType {
1872                    raw: self.raw,
1873                    _phantom: ::core::marker::PhantomData,
1874                })
1875            } else {
1876                None
1877            }
1878        }
1879    }
1880
1881    unsafe impl<___D> ::fidl_next::Decode<___D> for I2cImplOpType<'static>
1882    where
1883        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1884        ___D: ::fidl_next::Decoder,
1885    {
1886        fn decode(
1887            mut slot: ::fidl_next::Slot<'_, Self>,
1888            decoder: &mut ___D,
1889            _: (),
1890        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1891            ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
1892            match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
1893                1 => ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireU32>(
1894                    raw,
1895                    decoder,
1896                    (),
1897                )?,
1898
1899                2 => ::fidl_next::RawWireUnion::decode_as::<
1900                    ___D,
1901                    ::fidl_next::WireVector<'static, u8>,
1902                >(raw, decoder, (32768, ()))?,
1903
1904                0 => ::fidl_next::RawWireUnion::decode_absent(raw)?,
1905                _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
1906            }
1907
1908            Ok(())
1909        }
1910    }
1911
1912    impl<'de> ::core::fmt::Debug for I2cImplOpType<'de> {
1913        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1914            self.as_ref().fmt(f)
1915        }
1916    }
1917
1918    impl<'de> ::fidl_next::IntoNatural for I2cImplOpType<'de> {
1919        type Natural = ::core::option::Option<crate::natural::I2cImplOpType>;
1920    }
1921
1922    impl ::fidl_next::Unconstrained for I2cImplOpType<'static> {}
1923}
1924
1925pub mod generic {
1926
1927    pub struct DeviceGetMaxTransferSizeResponse<T0> {
1928        pub size: T0,
1929    }
1930
1931    unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceGetMaxTransferSizeResponse, ___E>
1932        for DeviceGetMaxTransferSizeResponse<T0>
1933    where
1934        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1935        T0: ::fidl_next::Encode<::fidl_next::WireU64, ___E>,
1936    {
1937        #[inline]
1938        fn encode(
1939            self,
1940            encoder_: &mut ___E,
1941            out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetMaxTransferSizeResponse>,
1942            _: (),
1943        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1944            ::fidl_next::munge! {
1945                let crate::wire::DeviceGetMaxTransferSizeResponse {
1946
1947                    size,
1948
1949                } = out_;
1950            }
1951
1952            ::fidl_next::Encode::encode(self.size, encoder_, size, ())?;
1953
1954            Ok(())
1955        }
1956    }
1957
1958    pub struct DeviceSetBitrateRequest<T0> {
1959        pub bitrate: T0,
1960    }
1961
1962    unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceSetBitrateRequest, ___E>
1963        for DeviceSetBitrateRequest<T0>
1964    where
1965        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1966        T0: ::fidl_next::Encode<::fidl_next::WireU32, ___E>,
1967    {
1968        #[inline]
1969        fn encode(
1970            self,
1971            encoder_: &mut ___E,
1972            out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceSetBitrateRequest>,
1973            _: (),
1974        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1975            ::fidl_next::munge! {
1976                let crate::wire::DeviceSetBitrateRequest {
1977
1978                    bitrate,
1979
1980                } = out_;
1981            }
1982
1983            ::fidl_next::Encode::encode(self.bitrate, encoder_, bitrate, ())?;
1984
1985            Ok(())
1986        }
1987    }
1988
1989    pub struct I2cImplOp<T0, T1, T2> {
1990        pub address: T0,
1991
1992        pub type_: T1,
1993
1994        pub stop: T2,
1995    }
1996
1997    unsafe impl<___E, T0, T1, T2> ::fidl_next::Encode<crate::wire::I2cImplOp<'static>, ___E>
1998        for I2cImplOp<T0, T1, T2>
1999    where
2000        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2001        ___E: ::fidl_next::Encoder,
2002        T0: ::fidl_next::Encode<::fidl_next::WireU16, ___E>,
2003        T1: ::fidl_next::Encode<crate::wire::I2cImplOpType<'static>, ___E>,
2004        T2: ::fidl_next::Encode<bool, ___E>,
2005    {
2006        #[inline]
2007        fn encode(
2008            self,
2009            encoder_: &mut ___E,
2010            out_: &mut ::core::mem::MaybeUninit<crate::wire::I2cImplOp<'static>>,
2011            _: (),
2012        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2013            ::fidl_next::munge! {
2014                let crate::wire::I2cImplOp {
2015
2016                    address,
2017                    type_,
2018                    stop,
2019
2020                } = out_;
2021            }
2022
2023            ::fidl_next::Encode::encode(self.address, encoder_, address, ())?;
2024
2025            ::fidl_next::Encode::encode(self.type_, encoder_, type_, ())?;
2026
2027            ::fidl_next::Encode::encode(self.stop, encoder_, stop, ())?;
2028
2029            Ok(())
2030        }
2031    }
2032
2033    pub struct DeviceTransactRequest<T0> {
2034        pub op: T0,
2035    }
2036
2037    unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceTransactRequest<'static>, ___E>
2038        for DeviceTransactRequest<T0>
2039    where
2040        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2041        ___E: ::fidl_next::Encoder,
2042        T0: ::fidl_next::Encode<
2043                ::fidl_next::WireVector<'static, crate::wire::I2cImplOp<'static>>,
2044                ___E,
2045            >,
2046    {
2047        #[inline]
2048        fn encode(
2049            self,
2050            encoder_: &mut ___E,
2051            out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceTransactRequest<'static>>,
2052            _: (),
2053        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2054            ::fidl_next::munge! {
2055                let crate::wire::DeviceTransactRequest {
2056
2057                    op,
2058
2059                } = out_;
2060            }
2061
2062            ::fidl_next::Encode::encode(self.op, encoder_, op, (256, ()))?;
2063
2064            Ok(())
2065        }
2066    }
2067
2068    pub struct ReadData<T0> {
2069        pub data: T0,
2070    }
2071
2072    unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::ReadData<'static>, ___E> for ReadData<T0>
2073    where
2074        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2075        ___E: ::fidl_next::Encoder,
2076        T0: ::fidl_next::Encode<::fidl_next::WireVector<'static, u8>, ___E>,
2077    {
2078        #[inline]
2079        fn encode(
2080            self,
2081            encoder_: &mut ___E,
2082            out_: &mut ::core::mem::MaybeUninit<crate::wire::ReadData<'static>>,
2083            _: (),
2084        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2085            ::fidl_next::munge! {
2086                let crate::wire::ReadData {
2087
2088                    data,
2089
2090                } = out_;
2091            }
2092
2093            ::fidl_next::Encode::encode(self.data, encoder_, data, (32768, ()))?;
2094
2095            Ok(())
2096        }
2097    }
2098
2099    pub struct DeviceTransactResponse<T0> {
2100        pub read: T0,
2101    }
2102
2103    unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceTransactResponse<'static>, ___E>
2104        for DeviceTransactResponse<T0>
2105    where
2106        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2107        ___E: ::fidl_next::Encoder,
2108        T0: ::fidl_next::Encode<
2109                ::fidl_next::WireVector<'static, crate::wire::ReadData<'static>>,
2110                ___E,
2111            >,
2112    {
2113        #[inline]
2114        fn encode(
2115            self,
2116            encoder_: &mut ___E,
2117            out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceTransactResponse<'static>>,
2118            _: (),
2119        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2120            ::fidl_next::munge! {
2121                let crate::wire::DeviceTransactResponse {
2122
2123                    read,
2124
2125                } = out_;
2126            }
2127
2128            ::fidl_next::Encode::encode(self.read, encoder_, read, (256, ()))?;
2129
2130            Ok(())
2131        }
2132    }
2133}
2134
2135pub use self::natural::*;
2136
2137/// The type corresponding to the Device protocol.
2138#[doc = " Low-level protocol for i2c drivers.\n"]
2139#[derive(PartialEq, Debug)]
2140pub struct Device;
2141
2142impl ::fidl_next::Discoverable for Device {
2143    const PROTOCOL_NAME: &'static str = "fuchsia.hardware.i2cimpl.Device";
2144}
2145
2146#[cfg(feature = "driver")]
2147impl ::fidl_next::HasTransport for Device {
2148    type Transport = ::fdf_fidl::DriverChannel;
2149}
2150
2151pub mod device {
2152    pub mod prelude {
2153        pub use crate::{Device, DeviceClientHandler, DeviceServerHandler, device};
2154
2155        pub use crate::natural::DeviceSetBitrateRequest;
2156
2157        pub use crate::natural::DeviceTransactRequest;
2158
2159        pub use crate::natural::DeviceGetMaxTransferSizeResponse;
2160
2161        pub use crate::natural::DeviceSetBitrateResponse;
2162
2163        pub use crate::natural::DeviceTransactResponse;
2164    }
2165
2166    pub struct GetMaxTransferSize;
2167
2168    impl ::fidl_next::Method for GetMaxTransferSize {
2169        const ORDINAL: u64 = 5122675640437495577;
2170        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
2171            ::fidl_next::protocol::Flexibility::Flexible;
2172
2173        type Protocol = crate::Device;
2174
2175        type Request = ();
2176    }
2177
2178    impl ::fidl_next::TwoWayMethod for GetMaxTransferSize {
2179        type Response = ::fidl_next::WireFlexibleResult<
2180            'static,
2181            crate::wire::DeviceGetMaxTransferSizeResponse,
2182            ::fidl_next::WireI32,
2183        >;
2184    }
2185
2186    impl<___R> ::fidl_next::Respond<___R> for GetMaxTransferSize {
2187        type Output = ::fidl_next::FlexibleResult<
2188            crate::generic::DeviceGetMaxTransferSizeResponse<___R>,
2189            ::fidl_next::util::Never,
2190        >;
2191
2192        fn respond(response: ___R) -> Self::Output {
2193            ::fidl_next::FlexibleResult::Ok(crate::generic::DeviceGetMaxTransferSizeResponse {
2194                size: response,
2195            })
2196        }
2197    }
2198
2199    impl<___R> ::fidl_next::RespondErr<___R> for GetMaxTransferSize {
2200        type Output = ::fidl_next::FlexibleResult<::fidl_next::util::Never, ___R>;
2201
2202        fn respond_err(response: ___R) -> Self::Output {
2203            ::fidl_next::FlexibleResult::Err(response)
2204        }
2205    }
2206
2207    pub struct SetBitrate;
2208
2209    impl ::fidl_next::Method for SetBitrate {
2210        const ORDINAL: u64 = 8193992212524563188;
2211        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
2212            ::fidl_next::protocol::Flexibility::Flexible;
2213
2214        type Protocol = crate::Device;
2215
2216        type Request = crate::wire::DeviceSetBitrateRequest;
2217    }
2218
2219    impl ::fidl_next::TwoWayMethod for SetBitrate {
2220        type Response = ::fidl_next::WireFlexibleResult<
2221            'static,
2222            crate::wire::DeviceSetBitrateResponse,
2223            ::fidl_next::WireI32,
2224        >;
2225    }
2226
2227    impl<___R> ::fidl_next::Respond<___R> for SetBitrate {
2228        type Output = ::fidl_next::FlexibleResult<___R, ::fidl_next::util::Never>;
2229
2230        fn respond(response: ___R) -> Self::Output {
2231            ::fidl_next::FlexibleResult::Ok(response)
2232        }
2233    }
2234
2235    impl<___R> ::fidl_next::RespondErr<___R> for SetBitrate {
2236        type Output = ::fidl_next::FlexibleResult<::fidl_next::util::Never, ___R>;
2237
2238        fn respond_err(response: ___R) -> Self::Output {
2239            ::fidl_next::FlexibleResult::Err(response)
2240        }
2241    }
2242
2243    pub struct Transact;
2244
2245    impl ::fidl_next::Method for Transact {
2246        const ORDINAL: u64 = 6461839908402215334;
2247        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
2248            ::fidl_next::protocol::Flexibility::Flexible;
2249
2250        type Protocol = crate::Device;
2251
2252        type Request = crate::wire::DeviceTransactRequest<'static>;
2253    }
2254
2255    impl ::fidl_next::TwoWayMethod for Transact {
2256        type Response = ::fidl_next::WireFlexibleResult<
2257            'static,
2258            crate::wire::DeviceTransactResponse<'static>,
2259            ::fidl_next::WireI32,
2260        >;
2261    }
2262
2263    impl<___R> ::fidl_next::Respond<___R> for Transact {
2264        type Output = ::fidl_next::FlexibleResult<
2265            crate::generic::DeviceTransactResponse<___R>,
2266            ::fidl_next::util::Never,
2267        >;
2268
2269        fn respond(response: ___R) -> Self::Output {
2270            ::fidl_next::FlexibleResult::Ok(crate::generic::DeviceTransactResponse {
2271                read: response,
2272            })
2273        }
2274    }
2275
2276    impl<___R> ::fidl_next::RespondErr<___R> for Transact {
2277        type Output = ::fidl_next::FlexibleResult<::fidl_next::util::Never, ___R>;
2278
2279        fn respond_err(response: ___R) -> Self::Output {
2280            ::fidl_next::FlexibleResult::Err(response)
2281        }
2282    }
2283
2284    mod ___detail {
2285        unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Device
2286        where
2287            ___T: ::fidl_next::Transport,
2288        {
2289            type Client = DeviceClient<___T>;
2290            type Server = DeviceServer<___T>;
2291        }
2292
2293        /// The client for the `Device` protocol.
2294        #[repr(transparent)]
2295        pub struct DeviceClient<___T: ::fidl_next::Transport> {
2296            #[allow(dead_code)]
2297            client: ::fidl_next::protocol::Client<___T>,
2298        }
2299
2300        impl<___T> DeviceClient<___T>
2301        where
2302            ___T: ::fidl_next::Transport,
2303        {
2304            pub fn get_max_transfer_size(
2305                &self,
2306            ) -> ::fidl_next::TwoWayFuture<'_, super::GetMaxTransferSize, ___T> {
2307                ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
2308                    5122675640437495577,
2309                    <super::GetMaxTransferSize as ::fidl_next::Method>::FLEXIBILITY,
2310                    (),
2311                ))
2312            }
2313
2314            #[doc = " Sets the bitrate for the i2c bus in KHz units.\n"]
2315            pub fn set_bitrate(
2316                &self,
2317
2318                bitrate: impl ::fidl_next::Encode<
2319                    ::fidl_next::WireU32,
2320                    <___T as ::fidl_next::Transport>::SendBuffer,
2321                >,
2322            ) -> ::fidl_next::TwoWayFuture<'_, super::SetBitrate, ___T>
2323            where
2324                <___T as ::fidl_next::Transport>::SendBuffer:
2325                    ::fidl_next::encoder::InternalHandleEncoder,
2326            {
2327                self.set_bitrate_with(crate::generic::DeviceSetBitrateRequest { bitrate })
2328            }
2329
2330            #[doc = " Sets the bitrate for the i2c bus in KHz units.\n"]
2331            pub fn set_bitrate_with<___R>(
2332                &self,
2333                request: ___R,
2334            ) -> ::fidl_next::TwoWayFuture<'_, super::SetBitrate, ___T>
2335            where
2336                ___R: ::fidl_next::Encode<
2337                        crate::wire::DeviceSetBitrateRequest,
2338                        <___T as ::fidl_next::Transport>::SendBuffer,
2339                    >,
2340            {
2341                ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
2342                    8193992212524563188,
2343                    <super::SetBitrate as ::fidl_next::Method>::FLEXIBILITY,
2344                    request,
2345                ))
2346            }
2347
2348            #[doc = " |Transact| assumes that write ops write_data length are not zero.\n |Transact| assumes that at least the last op has stop set to true.\n\n For each read-transaction, there will be a corresponding ReadData\n returned. Write-transactions produce no data result.\n"]
2349            pub fn transact(
2350                &self,
2351
2352                op: impl ::fidl_next::Encode<
2353                    ::fidl_next::WireVector<'static, crate::wire::I2cImplOp<'static>>,
2354                    <___T as ::fidl_next::Transport>::SendBuffer,
2355                >,
2356            ) -> ::fidl_next::TwoWayFuture<'_, super::Transact, ___T>
2357            where
2358                <___T as ::fidl_next::Transport>::SendBuffer:
2359                    ::fidl_next::encoder::InternalHandleEncoder,
2360                <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
2361            {
2362                self.transact_with(crate::generic::DeviceTransactRequest { op })
2363            }
2364
2365            #[doc = " |Transact| assumes that write ops write_data length are not zero.\n |Transact| assumes that at least the last op has stop set to true.\n\n For each read-transaction, there will be a corresponding ReadData\n returned. Write-transactions produce no data result.\n"]
2366            pub fn transact_with<___R>(
2367                &self,
2368                request: ___R,
2369            ) -> ::fidl_next::TwoWayFuture<'_, super::Transact, ___T>
2370            where
2371                ___R: ::fidl_next::Encode<
2372                        crate::wire::DeviceTransactRequest<'static>,
2373                        <___T as ::fidl_next::Transport>::SendBuffer,
2374                    >,
2375            {
2376                ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
2377                    6461839908402215334,
2378                    <super::Transact as ::fidl_next::Method>::FLEXIBILITY,
2379                    request,
2380                ))
2381            }
2382        }
2383
2384        /// The server for the `Device` protocol.
2385        #[repr(transparent)]
2386        pub struct DeviceServer<___T: ::fidl_next::Transport> {
2387            server: ::fidl_next::protocol::Server<___T>,
2388        }
2389
2390        impl<___T> DeviceServer<___T> where ___T: ::fidl_next::Transport {}
2391    }
2392}
2393
2394/// A client handler for the Device protocol.
2395///
2396/// See [`Device`] for more details.
2397pub trait DeviceClientHandler<
2398    #[cfg(feature = "driver")] ___T: ::fidl_next::Transport = ::fdf_fidl::DriverChannel,
2399    #[cfg(not(feature = "driver"))] ___T: ::fidl_next::Transport,
2400>
2401{
2402    fn on_unknown_interaction(
2403        &mut self,
2404        ordinal: u64,
2405    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
2406        ::core::future::ready(())
2407    }
2408}
2409
2410impl<___T> DeviceClientHandler<___T> for ::fidl_next::IgnoreEvents
2411where
2412    ___T: ::fidl_next::Transport,
2413{
2414    async fn on_unknown_interaction(&mut self, _: u64) {}
2415}
2416
2417impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Device
2418where
2419    ___H: DeviceClientHandler<___T> + ::core::marker::Send,
2420    ___T: ::fidl_next::Transport,
2421{
2422    async fn on_event(
2423        handler: &mut ___H,
2424        ordinal: u64,
2425        flexibility: ::fidl_next::protocol::Flexibility,
2426        buffer: ___T::RecvBuffer,
2427    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
2428        match ordinal {
2429            ordinal => {
2430                handler.on_unknown_interaction(ordinal).await;
2431                if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
2432                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2433                } else {
2434                    Ok(())
2435                }
2436            }
2437        }
2438    }
2439}
2440
2441/// A server handler for the Device protocol.
2442///
2443/// See [`Device`] for more details.
2444pub trait DeviceServerHandler<
2445    #[cfg(feature = "driver")] ___T: ::fidl_next::Transport = ::fdf_fidl::DriverChannel,
2446    #[cfg(not(feature = "driver"))] ___T: ::fidl_next::Transport,
2447>
2448{
2449    fn get_max_transfer_size(
2450        &mut self,
2451
2452        responder: ::fidl_next::Responder<device::GetMaxTransferSize, ___T>,
2453    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2454
2455    #[doc = " Sets the bitrate for the i2c bus in KHz units.\n"]
2456    fn set_bitrate(
2457        &mut self,
2458
2459        request: ::fidl_next::Request<device::SetBitrate, ___T>,
2460
2461        responder: ::fidl_next::Responder<device::SetBitrate, ___T>,
2462    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2463
2464    #[doc = " |Transact| assumes that write ops write_data length are not zero.\n |Transact| assumes that at least the last op has stop set to true.\n\n For each read-transaction, there will be a corresponding ReadData\n returned. Write-transactions produce no data result.\n"]
2465    fn transact(
2466        &mut self,
2467
2468        request: ::fidl_next::Request<device::Transact, ___T>,
2469
2470        responder: ::fidl_next::Responder<device::Transact, ___T>,
2471    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2472
2473    fn on_unknown_interaction(
2474        &mut self,
2475        ordinal: u64,
2476    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
2477        ::core::future::ready(())
2478    }
2479}
2480
2481impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Device
2482where
2483    ___H: DeviceServerHandler<___T> + ::core::marker::Send,
2484    ___T: ::fidl_next::Transport,
2485    <device::SetBitrate as ::fidl_next::Method>::Request:
2486        ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
2487    <device::Transact as ::fidl_next::Method>::Request:
2488        ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
2489{
2490    async fn on_one_way(
2491        handler: &mut ___H,
2492        ordinal: u64,
2493        flexibility: ::fidl_next::protocol::Flexibility,
2494        buffer: ___T::RecvBuffer,
2495    ) -> ::core::result::Result<
2496        (),
2497        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
2498    > {
2499        match ordinal {
2500            ordinal => {
2501                handler.on_unknown_interaction(ordinal).await;
2502                if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
2503                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2504                } else {
2505                    Ok(())
2506                }
2507            }
2508        }
2509    }
2510
2511    async fn on_two_way(
2512        handler: &mut ___H,
2513        ordinal: u64,
2514        flexibility: ::fidl_next::protocol::Flexibility,
2515        buffer: ___T::RecvBuffer,
2516        responder: ::fidl_next::protocol::Responder<___T>,
2517    ) -> ::core::result::Result<
2518        (),
2519        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
2520    > {
2521        match ordinal {
2522            5122675640437495577 => {
2523                let responder = ::fidl_next::Responder::from_untyped(responder);
2524
2525                handler.get_max_transfer_size(responder).await;
2526                Ok(())
2527            }
2528
2529            8193992212524563188 => {
2530                let responder = ::fidl_next::Responder::from_untyped(responder);
2531
2532                match ::fidl_next::DecoderExt::decode(buffer) {
2533                    Ok(decoded) => {
2534                        handler
2535                            .set_bitrate(::fidl_next::Request::from_decoded(decoded), responder)
2536                            .await;
2537                        Ok(())
2538                    }
2539                    Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2540                        ordinal: 8193992212524563188,
2541                        error,
2542                    }),
2543                }
2544            }
2545
2546            6461839908402215334 => {
2547                let responder = ::fidl_next::Responder::from_untyped(responder);
2548
2549                match ::fidl_next::DecoderExt::decode(buffer) {
2550                    Ok(decoded) => {
2551                        handler
2552                            .transact(::fidl_next::Request::from_decoded(decoded), responder)
2553                            .await;
2554                        Ok(())
2555                    }
2556                    Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2557                        ordinal: 6461839908402215334,
2558                        error,
2559                    }),
2560                }
2561            }
2562
2563            ordinal => {
2564                handler.on_unknown_interaction(ordinal).await;
2565                if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
2566                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2567                } else {
2568                    responder
2569                        .respond(
2570                            ordinal,
2571                            flexibility,
2572                            ::fidl_next::Flexible::<()>::FrameworkErr(
2573                                ::fidl_next::FrameworkError::UnknownMethod,
2574                            ),
2575                        )
2576                        .expect("encoding a framework error should never fail")
2577                        .await?;
2578                    Ok(())
2579                }
2580            }
2581        }
2582    }
2583}
2584
2585/// Compatibility shims which mimic some API surfaces of the current Rust bindings.
2586pub mod compat {
2587
2588    #[cfg(feature = "driver")]
2589    impl ::fidl_next::CompatFrom<crate::DeviceGetMaxTransferSizeResponse>
2590        for ::fidl_fuchsia_hardware_i2cimpl::DeviceGetMaxTransferSizeResponse
2591    {
2592        #[inline]
2593        fn compat_from(value: crate::DeviceGetMaxTransferSizeResponse) -> Self {
2594            Self { size: ::fidl_next::CompatFrom::compat_from(value.size) }
2595        }
2596    }
2597
2598    #[cfg(feature = "driver")]
2599    impl ::fidl_next::CompatFrom<::fidl_fuchsia_hardware_i2cimpl::DeviceGetMaxTransferSizeResponse>
2600        for crate::DeviceGetMaxTransferSizeResponse
2601    {
2602        #[inline]
2603        fn compat_from(
2604            value: ::fidl_fuchsia_hardware_i2cimpl::DeviceGetMaxTransferSizeResponse,
2605        ) -> Self {
2606            Self { size: ::fidl_next::CompatFrom::compat_from(value.size) }
2607        }
2608    }
2609
2610    #[cfg(feature = "driver")]
2611    impl ::fidl_next::CompatFrom<crate::DeviceSetBitrateRequest>
2612        for ::fidl_fuchsia_hardware_i2cimpl::DeviceSetBitrateRequest
2613    {
2614        #[inline]
2615        fn compat_from(value: crate::DeviceSetBitrateRequest) -> Self {
2616            Self { bitrate: ::fidl_next::CompatFrom::compat_from(value.bitrate) }
2617        }
2618    }
2619
2620    #[cfg(feature = "driver")]
2621    impl ::fidl_next::CompatFrom<::fidl_fuchsia_hardware_i2cimpl::DeviceSetBitrateRequest>
2622        for crate::DeviceSetBitrateRequest
2623    {
2624        #[inline]
2625        fn compat_from(value: ::fidl_fuchsia_hardware_i2cimpl::DeviceSetBitrateRequest) -> Self {
2626            Self { bitrate: ::fidl_next::CompatFrom::compat_from(value.bitrate) }
2627        }
2628    }
2629
2630    impl ::fidl_next::CompatFrom<crate::I2cImplOpType>
2631        for ::fidl_fuchsia_hardware_i2cimpl::I2cImplOpType
2632    {
2633        fn compat_from(value: crate::I2cImplOpType) -> Self {
2634            match value {
2635                crate::I2cImplOpType::ReadSize(value) => {
2636                    Self::ReadSize(::fidl_next::CompatFrom::compat_from(value))
2637                }
2638
2639                crate::I2cImplOpType::WriteData(value) => {
2640                    Self::WriteData(::fidl_next::CompatFrom::compat_from(value))
2641                }
2642            }
2643        }
2644    }
2645
2646    impl ::fidl_next::CompatFrom<::fidl_fuchsia_hardware_i2cimpl::I2cImplOpType>
2647        for crate::I2cImplOpType
2648    {
2649        fn compat_from(value: ::fidl_fuchsia_hardware_i2cimpl::I2cImplOpType) -> Self {
2650            match value {
2651                ::fidl_fuchsia_hardware_i2cimpl::I2cImplOpType::ReadSize(value) => {
2652                    Self::ReadSize(::fidl_next::CompatFrom::compat_from(value))
2653                }
2654
2655                ::fidl_fuchsia_hardware_i2cimpl::I2cImplOpType::WriteData(value) => {
2656                    Self::WriteData(::fidl_next::CompatFrom::compat_from(value))
2657                }
2658            }
2659        }
2660    }
2661
2662    impl ::fidl_next::CompatFrom<crate::I2cImplOp> for ::fidl_fuchsia_hardware_i2cimpl::I2cImplOp {
2663        #[inline]
2664        fn compat_from(value: crate::I2cImplOp) -> Self {
2665            Self {
2666                address: ::fidl_next::CompatFrom::compat_from(value.address),
2667
2668                type_: ::fidl_next::CompatFrom::compat_from(value.type_),
2669
2670                stop: ::fidl_next::CompatFrom::compat_from(value.stop),
2671            }
2672        }
2673    }
2674
2675    impl ::fidl_next::CompatFrom<::fidl_fuchsia_hardware_i2cimpl::I2cImplOp> for crate::I2cImplOp {
2676        #[inline]
2677        fn compat_from(value: ::fidl_fuchsia_hardware_i2cimpl::I2cImplOp) -> Self {
2678            Self {
2679                address: ::fidl_next::CompatFrom::compat_from(value.address),
2680
2681                type_: ::fidl_next::CompatFrom::compat_from(value.type_),
2682
2683                stop: ::fidl_next::CompatFrom::compat_from(value.stop),
2684            }
2685        }
2686    }
2687
2688    #[cfg(feature = "driver")]
2689    impl ::fidl_next::CompatFrom<crate::DeviceTransactRequest>
2690        for ::fidl_fuchsia_hardware_i2cimpl::DeviceTransactRequest
2691    {
2692        #[inline]
2693        fn compat_from(value: crate::DeviceTransactRequest) -> Self {
2694            Self { op: ::fidl_next::CompatFrom::compat_from(value.op) }
2695        }
2696    }
2697
2698    #[cfg(feature = "driver")]
2699    impl ::fidl_next::CompatFrom<::fidl_fuchsia_hardware_i2cimpl::DeviceTransactRequest>
2700        for crate::DeviceTransactRequest
2701    {
2702        #[inline]
2703        fn compat_from(value: ::fidl_fuchsia_hardware_i2cimpl::DeviceTransactRequest) -> Self {
2704            Self { op: ::fidl_next::CompatFrom::compat_from(value.op) }
2705        }
2706    }
2707
2708    impl ::fidl_next::CompatFrom<crate::ReadData> for ::fidl_fuchsia_hardware_i2cimpl::ReadData {
2709        #[inline]
2710        fn compat_from(value: crate::ReadData) -> Self {
2711            Self { data: ::fidl_next::CompatFrom::compat_from(value.data) }
2712        }
2713    }
2714
2715    impl ::fidl_next::CompatFrom<::fidl_fuchsia_hardware_i2cimpl::ReadData> for crate::ReadData {
2716        #[inline]
2717        fn compat_from(value: ::fidl_fuchsia_hardware_i2cimpl::ReadData) -> Self {
2718            Self { data: ::fidl_next::CompatFrom::compat_from(value.data) }
2719        }
2720    }
2721
2722    #[cfg(feature = "driver")]
2723    impl ::fidl_next::CompatFrom<crate::DeviceTransactResponse>
2724        for ::fidl_fuchsia_hardware_i2cimpl::DeviceTransactResponse
2725    {
2726        #[inline]
2727        fn compat_from(value: crate::DeviceTransactResponse) -> Self {
2728            Self { read: ::fidl_next::CompatFrom::compat_from(value.read) }
2729        }
2730    }
2731
2732    #[cfg(feature = "driver")]
2733    impl ::fidl_next::CompatFrom<::fidl_fuchsia_hardware_i2cimpl::DeviceTransactResponse>
2734        for crate::DeviceTransactResponse
2735    {
2736        #[inline]
2737        fn compat_from(value: ::fidl_fuchsia_hardware_i2cimpl::DeviceTransactResponse) -> Self {
2738            Self { read: ::fidl_next::CompatFrom::compat_from(value.read) }
2739        }
2740    }
2741
2742    #[cfg(target_os = "fuchsia")]
2743    /// An alias for a client over `zx::Channel` for the `Device`
2744    /// protocol.
2745    pub type DeviceProxy = ::fidl_next::Client<crate::Device>;
2746
2747    #[cfg(feature = "driver")]
2748    impl ::fidl_next::CompatFrom<crate::Device> for ::fidl_fuchsia_hardware_i2cimpl::DeviceMarker {
2749        fn compat_from(_: crate::Device) -> Self {
2750            Self
2751        }
2752    }
2753
2754    #[cfg(feature = "driver")]
2755    impl ::fidl_next::CompatFrom<::fidl_fuchsia_hardware_i2cimpl::DeviceMarker> for crate::Device {
2756        fn compat_from(_: ::fidl_fuchsia_hardware_i2cimpl::DeviceMarker) -> Self {
2757            Self
2758        }
2759    }
2760}