Skip to main content

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