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