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 pub enum Value<'de> {
1313 ReadSize(::fidl_next::wire::Uint32),
1314
1315 WriteData(::fidl_next::wire::Vector<'de, u8>),
1316 }
1317 }
1318
1319 impl<'de> I2cImplOpType<'de> {
1320 pub fn as_ref(&self) -> crate::wire::i2c_impl_op_type::Ref<'_> {
1321 match self.raw.ordinal() {
1322 1 => crate::wire::i2c_impl_op_type::Ref::ReadSize(unsafe {
1323 self.raw.get().deref_unchecked::<::fidl_next::wire::Uint32>()
1324 }),
1325
1326 2 => crate::wire::i2c_impl_op_type::Ref::WriteData(unsafe {
1327 self.raw.get().deref_unchecked::<::fidl_next::wire::Vector<'_, u8>>()
1328 }),
1329
1330 _ => unsafe { ::core::hint::unreachable_unchecked() },
1331 }
1332 }
1333
1334 pub fn into_inner(self) -> crate::wire::i2c_impl_op_type::Value<'de> {
1335 let this = ::core::mem::ManuallyDrop::new(self);
1336
1337 match this.raw.ordinal() {
1338 1 => crate::wire::i2c_impl_op_type::Value::ReadSize(unsafe {
1339 this.raw.get().read_unchecked::<::fidl_next::wire::Uint32>()
1340 }),
1341
1342 2 => crate::wire::i2c_impl_op_type::Value::WriteData(unsafe {
1343 this.raw.get().read_unchecked::<::fidl_next::wire::Vector<'de, u8>>()
1344 }),
1345
1346 _ => unsafe { ::core::hint::unreachable_unchecked() },
1347 }
1348 }
1349 }
1350
1351 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for I2cImplOpType<'de>
1352 where
1353 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1354 ___D: ::fidl_next::Decoder<'de>,
1355 {
1356 fn decode(
1357 mut slot: ::fidl_next::Slot<'_, Self>,
1358 decoder: &mut ___D,
1359 _: (),
1360 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1361 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
1362 match ::fidl_next::wire::Union::encoded_ordinal(raw.as_mut()) {
1363 1 => ::fidl_next::wire::Union::decode_as::<___D, ::fidl_next::wire::Uint32>(
1364 raw,
1365 decoder,
1366 (),
1367 )?,
1368
1369 2 => {
1370 ::fidl_next::wire::Union::decode_as::<___D, ::fidl_next::wire::Vector<'de, u8>>(
1371 raw,
1372 decoder,
1373 (32768, ()),
1374 )?
1375 }
1376
1377 ord => return Err(::fidl_next::DecodeError::InvalidUnionOrdinal(ord as usize)),
1378 }
1379
1380 Ok(())
1381 }
1382 }
1383
1384 impl<'de> ::core::fmt::Debug for I2cImplOpType<'de> {
1385 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1386 match self.raw.ordinal() {
1387 1 => unsafe {
1388 self.raw.get().deref_unchecked::<::fidl_next::wire::Uint32>().fmt(f)
1389 },
1390 2 => unsafe {
1391 self.raw.get().deref_unchecked::<::fidl_next::wire::Vector<'_, u8>>().fmt(f)
1392 },
1393 _ => unsafe { ::core::hint::unreachable_unchecked() },
1394 }
1395 }
1396 }
1397
1398 impl<'de> ::fidl_next::IntoNatural for I2cImplOpType<'de> {
1399 type Natural = crate::natural::I2cImplOpType;
1400 }
1401
1402 #[derive(Debug)]
1404 #[repr(C)]
1405 pub struct I2cImplOp<'de> {
1406 pub address: ::fidl_next::wire::Uint16,
1407
1408 pub type_: crate::wire::I2cImplOpType<'de>,
1409
1410 pub stop: bool,
1411 }
1412
1413 static_assertions::const_assert_eq!(std::mem::size_of::<I2cImplOp<'_>>(), 32);
1414 static_assertions::const_assert_eq!(std::mem::align_of::<I2cImplOp<'_>>(), 8);
1415
1416 static_assertions::const_assert_eq!(std::mem::offset_of!(I2cImplOp<'_>, address), 0);
1417
1418 static_assertions::const_assert_eq!(std::mem::offset_of!(I2cImplOp<'_>, type_), 8);
1419
1420 static_assertions::const_assert_eq!(std::mem::offset_of!(I2cImplOp<'_>, stop), 24);
1421
1422 impl ::fidl_next::Constrained for I2cImplOp<'_> {
1423 type Constraint = ();
1424
1425 fn validate(
1426 _: ::fidl_next::Slot<'_, Self>,
1427 _: Self::Constraint,
1428 ) -> Result<(), ::fidl_next::ValidationError> {
1429 Ok(())
1430 }
1431 }
1432
1433 unsafe impl ::fidl_next::Wire for I2cImplOp<'static> {
1434 type Narrowed<'de> = I2cImplOp<'de>;
1435
1436 #[inline]
1437 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1438 ::fidl_next::munge! {
1439 let Self {
1440 address,
1441 type_,
1442 stop,
1443
1444 } = &mut *out_;
1445 }
1446
1447 ::fidl_next::Wire::zero_padding(address);
1448
1449 ::fidl_next::Wire::zero_padding(type_);
1450
1451 ::fidl_next::Wire::zero_padding(stop);
1452
1453 unsafe {
1454 out_.as_mut_ptr().cast::<u8>().add(25).write_bytes(0, 7);
1455 }
1456
1457 unsafe {
1458 out_.as_mut_ptr().cast::<u8>().add(2).write_bytes(0, 6);
1459 }
1460 }
1461 }
1462
1463 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for I2cImplOp<'de>
1464 where
1465 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1466 ___D: ::fidl_next::Decoder<'de>,
1467 {
1468 fn decode(
1469 slot_: ::fidl_next::Slot<'_, Self>,
1470 decoder_: &mut ___D,
1471 _: (),
1472 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1473 if slot_.as_bytes()[25..32] != [0u8; 7] {
1474 return Err(::fidl_next::DecodeError::InvalidPadding);
1475 }
1476
1477 if slot_.as_bytes()[2..8] != [0u8; 6] {
1478 return Err(::fidl_next::DecodeError::InvalidPadding);
1479 }
1480
1481 ::fidl_next::munge! {
1482 let Self {
1483 mut address,
1484 mut type_,
1485 mut stop,
1486
1487 } = slot_;
1488 }
1489
1490 let _field = address.as_mut();
1491
1492 ::fidl_next::Decode::decode(address.as_mut(), decoder_, ())?;
1493
1494 let _field = type_.as_mut();
1495
1496 ::fidl_next::Decode::decode(type_.as_mut(), decoder_, ())?;
1497
1498 let _field = stop.as_mut();
1499
1500 ::fidl_next::Decode::decode(stop.as_mut(), decoder_, ())?;
1501
1502 Ok(())
1503 }
1504 }
1505
1506 impl<'de> ::fidl_next::IntoNatural for I2cImplOp<'de> {
1507 type Natural = crate::natural::I2cImplOp;
1508 }
1509
1510 #[derive(Debug)]
1512 #[repr(C)]
1513 pub struct DeviceTransactRequest<'de> {
1514 pub op: ::fidl_next::wire::Vector<'de, crate::wire::I2cImplOp<'de>>,
1515 }
1516
1517 static_assertions::const_assert_eq!(std::mem::size_of::<DeviceTransactRequest<'_>>(), 16);
1518 static_assertions::const_assert_eq!(std::mem::align_of::<DeviceTransactRequest<'_>>(), 8);
1519
1520 static_assertions::const_assert_eq!(std::mem::offset_of!(DeviceTransactRequest<'_>, op), 0);
1521
1522 impl ::fidl_next::Constrained for DeviceTransactRequest<'_> {
1523 type Constraint = ();
1524
1525 fn validate(
1526 _: ::fidl_next::Slot<'_, Self>,
1527 _: Self::Constraint,
1528 ) -> Result<(), ::fidl_next::ValidationError> {
1529 Ok(())
1530 }
1531 }
1532
1533 unsafe impl ::fidl_next::Wire for DeviceTransactRequest<'static> {
1534 type Narrowed<'de> = DeviceTransactRequest<'de>;
1535
1536 #[inline]
1537 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1538 ::fidl_next::munge! {
1539 let Self {
1540 op,
1541
1542 } = &mut *out_;
1543 }
1544
1545 ::fidl_next::Wire::zero_padding(op);
1546 }
1547 }
1548
1549 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for DeviceTransactRequest<'de>
1550 where
1551 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1552 ___D: ::fidl_next::Decoder<'de>,
1553 {
1554 fn decode(
1555 slot_: ::fidl_next::Slot<'_, Self>,
1556 decoder_: &mut ___D,
1557 _: (),
1558 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1559 ::fidl_next::munge! {
1560 let Self {
1561 mut op,
1562
1563 } = slot_;
1564 }
1565
1566 let _field = op.as_mut();
1567 ::fidl_next::Constrained::validate(_field, (256, ()))?;
1568 ::fidl_next::Decode::decode(op.as_mut(), decoder_, (256, ()))?;
1569
1570 let op = unsafe { op.deref_unchecked() };
1571
1572 if op.len() > 256 {
1573 return Err(::fidl_next::DecodeError::VectorTooLong {
1574 size: op.len() as u64,
1575 limit: 256,
1576 });
1577 }
1578
1579 Ok(())
1580 }
1581 }
1582
1583 impl<'de> ::fidl_next::IntoNatural for DeviceTransactRequest<'de> {
1584 type Natural = crate::natural::DeviceTransactRequest;
1585 }
1586
1587 #[derive(Debug)]
1589 #[repr(C)]
1590 pub struct ReadData<'de> {
1591 pub data: ::fidl_next::wire::Vector<'de, u8>,
1592 }
1593
1594 static_assertions::const_assert_eq!(std::mem::size_of::<ReadData<'_>>(), 16);
1595 static_assertions::const_assert_eq!(std::mem::align_of::<ReadData<'_>>(), 8);
1596
1597 static_assertions::const_assert_eq!(std::mem::offset_of!(ReadData<'_>, data), 0);
1598
1599 impl ::fidl_next::Constrained for ReadData<'_> {
1600 type Constraint = ();
1601
1602 fn validate(
1603 _: ::fidl_next::Slot<'_, Self>,
1604 _: Self::Constraint,
1605 ) -> Result<(), ::fidl_next::ValidationError> {
1606 Ok(())
1607 }
1608 }
1609
1610 unsafe impl ::fidl_next::Wire for ReadData<'static> {
1611 type Narrowed<'de> = ReadData<'de>;
1612
1613 #[inline]
1614 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1615 ::fidl_next::munge! {
1616 let Self {
1617 data,
1618
1619 } = &mut *out_;
1620 }
1621
1622 ::fidl_next::Wire::zero_padding(data);
1623 }
1624 }
1625
1626 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for ReadData<'de>
1627 where
1628 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1629 ___D: ::fidl_next::Decoder<'de>,
1630 {
1631 fn decode(
1632 slot_: ::fidl_next::Slot<'_, Self>,
1633 decoder_: &mut ___D,
1634 _: (),
1635 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1636 ::fidl_next::munge! {
1637 let Self {
1638 mut data,
1639
1640 } = slot_;
1641 }
1642
1643 let _field = data.as_mut();
1644 ::fidl_next::Constrained::validate(_field, (32768, ()))?;
1645 ::fidl_next::Decode::decode(data.as_mut(), decoder_, (32768, ()))?;
1646
1647 let data = unsafe { data.deref_unchecked() };
1648
1649 if data.len() > 32768 {
1650 return Err(::fidl_next::DecodeError::VectorTooLong {
1651 size: data.len() as u64,
1652 limit: 32768,
1653 });
1654 }
1655
1656 Ok(())
1657 }
1658 }
1659
1660 impl<'de> ::fidl_next::IntoNatural for ReadData<'de> {
1661 type Natural = crate::natural::ReadData;
1662 }
1663
1664 #[derive(Debug)]
1666 #[repr(C)]
1667 pub struct DeviceTransactResponse<'de> {
1668 pub read: ::fidl_next::wire::Vector<'de, crate::wire::ReadData<'de>>,
1669 }
1670
1671 static_assertions::const_assert_eq!(std::mem::size_of::<DeviceTransactResponse<'_>>(), 16);
1672 static_assertions::const_assert_eq!(std::mem::align_of::<DeviceTransactResponse<'_>>(), 8);
1673
1674 static_assertions::const_assert_eq!(std::mem::offset_of!(DeviceTransactResponse<'_>, read), 0);
1675
1676 impl ::fidl_next::Constrained for DeviceTransactResponse<'_> {
1677 type Constraint = ();
1678
1679 fn validate(
1680 _: ::fidl_next::Slot<'_, Self>,
1681 _: Self::Constraint,
1682 ) -> Result<(), ::fidl_next::ValidationError> {
1683 Ok(())
1684 }
1685 }
1686
1687 unsafe impl ::fidl_next::Wire for DeviceTransactResponse<'static> {
1688 type Narrowed<'de> = DeviceTransactResponse<'de>;
1689
1690 #[inline]
1691 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1692 ::fidl_next::munge! {
1693 let Self {
1694 read,
1695
1696 } = &mut *out_;
1697 }
1698
1699 ::fidl_next::Wire::zero_padding(read);
1700 }
1701 }
1702
1703 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for DeviceTransactResponse<'de>
1704 where
1705 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1706 ___D: ::fidl_next::Decoder<'de>,
1707 {
1708 fn decode(
1709 slot_: ::fidl_next::Slot<'_, Self>,
1710 decoder_: &mut ___D,
1711 _: (),
1712 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1713 ::fidl_next::munge! {
1714 let Self {
1715 mut read,
1716
1717 } = slot_;
1718 }
1719
1720 let _field = read.as_mut();
1721 ::fidl_next::Constrained::validate(_field, (256, ()))?;
1722 ::fidl_next::Decode::decode(read.as_mut(), decoder_, (256, ()))?;
1723
1724 let read = unsafe { read.deref_unchecked() };
1725
1726 if read.len() > 256 {
1727 return Err(::fidl_next::DecodeError::VectorTooLong {
1728 size: read.len() as u64,
1729 limit: 256,
1730 });
1731 }
1732
1733 Ok(())
1734 }
1735 }
1736
1737 impl<'de> ::fidl_next::IntoNatural for DeviceTransactResponse<'de> {
1738 type Natural = crate::natural::DeviceTransactResponse;
1739 }
1740}
1741
1742pub mod wire_optional {
1743
1744 #[repr(transparent)]
1745 pub struct I2cImplOpType<'de> {
1746 pub(crate) raw: ::fidl_next::wire::Union,
1747 pub(crate) _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
1748 }
1749
1750 impl ::fidl_next::Constrained for I2cImplOpType<'_> {
1751 type Constraint = ();
1752
1753 fn validate(
1754 _: ::fidl_next::Slot<'_, Self>,
1755 _: Self::Constraint,
1756 ) -> Result<(), ::fidl_next::ValidationError> {
1757 Ok(())
1758 }
1759 }
1760
1761 unsafe impl ::fidl_next::Wire for I2cImplOpType<'static> {
1762 type Narrowed<'de> = I2cImplOpType<'de>;
1763
1764 #[inline]
1765 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
1766 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
1767 ::fidl_next::wire::Union::zero_padding(raw);
1768 }
1769 }
1770
1771 impl<'de> I2cImplOpType<'de> {
1772 pub fn is_some(&self) -> bool {
1773 self.raw.is_some()
1774 }
1775
1776 pub fn is_none(&self) -> bool {
1777 self.raw.is_none()
1778 }
1779
1780 pub fn as_ref(&self) -> ::core::option::Option<&crate::wire::I2cImplOpType<'de>> {
1781 if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None }
1782 }
1783
1784 pub fn into_option(self) -> ::core::option::Option<crate::wire::I2cImplOpType<'de>> {
1785 if self.is_some() {
1786 Some(crate::wire::I2cImplOpType {
1787 raw: self.raw,
1788 _phantom: ::core::marker::PhantomData,
1789 })
1790 } else {
1791 None
1792 }
1793 }
1794 }
1795
1796 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for I2cImplOpType<'de>
1797 where
1798 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1799 ___D: ::fidl_next::Decoder<'de>,
1800 {
1801 fn decode(
1802 mut slot: ::fidl_next::Slot<'_, Self>,
1803 decoder: &mut ___D,
1804 _: (),
1805 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1806 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
1807 match ::fidl_next::wire::Union::encoded_ordinal(raw.as_mut()) {
1808 1 => ::fidl_next::wire::Union::decode_as::<___D, ::fidl_next::wire::Uint32>(
1809 raw,
1810 decoder,
1811 (),
1812 )?,
1813
1814 2 => {
1815 ::fidl_next::wire::Union::decode_as::<___D, ::fidl_next::wire::Vector<'de, u8>>(
1816 raw,
1817 decoder,
1818 (32768, ()),
1819 )?
1820 }
1821
1822 0 => ::fidl_next::wire::Union::decode_absent(raw)?,
1823 _ => ::fidl_next::wire::Union::decode_unknown(raw, decoder)?,
1824 }
1825
1826 Ok(())
1827 }
1828 }
1829
1830 impl<'de> ::core::fmt::Debug for I2cImplOpType<'de> {
1831 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1832 self.as_ref().fmt(f)
1833 }
1834 }
1835
1836 impl<'de> ::fidl_next::IntoNatural for I2cImplOpType<'de> {
1837 type Natural = ::core::option::Option<crate::natural::I2cImplOpType>;
1838 }
1839}
1840
1841pub mod generic {
1842
1843 pub struct DeviceGetMaxTransferSizeResponse<T0> {
1845 pub size: T0,
1846 }
1847
1848 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceGetMaxTransferSizeResponse, ___E>
1849 for DeviceGetMaxTransferSizeResponse<T0>
1850 where
1851 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1852 T0: ::fidl_next::Encode<::fidl_next::wire::Uint64, ___E>,
1853 {
1854 #[inline]
1855 fn encode(
1856 self,
1857 encoder_: &mut ___E,
1858 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetMaxTransferSizeResponse>,
1859 _: (),
1860 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1861 ::fidl_next::munge! {
1862 let crate::wire::DeviceGetMaxTransferSizeResponse {
1863 size,
1864
1865 } = out_;
1866 }
1867
1868 ::fidl_next::Encode::encode(self.size, encoder_, size, ())?;
1869
1870 Ok(())
1871 }
1872 }
1873
1874 pub struct DeviceSetBitrateRequest<T0> {
1876 pub bitrate: T0,
1877 }
1878
1879 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceSetBitrateRequest, ___E>
1880 for DeviceSetBitrateRequest<T0>
1881 where
1882 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1883 T0: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
1884 {
1885 #[inline]
1886 fn encode(
1887 self,
1888 encoder_: &mut ___E,
1889 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceSetBitrateRequest>,
1890 _: (),
1891 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1892 ::fidl_next::munge! {
1893 let crate::wire::DeviceSetBitrateRequest {
1894 bitrate,
1895
1896 } = out_;
1897 }
1898
1899 ::fidl_next::Encode::encode(self.bitrate, encoder_, bitrate, ())?;
1900
1901 Ok(())
1902 }
1903 }
1904
1905 pub type DeviceSetBitrateResponse = ();
1907
1908 pub struct I2cImplOp<T0, T1, T2> {
1910 pub address: T0,
1911
1912 pub type_: T1,
1913
1914 pub stop: T2,
1915 }
1916
1917 unsafe impl<___E, T0, T1, T2> ::fidl_next::Encode<crate::wire::I2cImplOp<'static>, ___E>
1918 for I2cImplOp<T0, T1, T2>
1919 where
1920 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1921 ___E: ::fidl_next::Encoder,
1922 T0: ::fidl_next::Encode<::fidl_next::wire::Uint16, ___E>,
1923 T1: ::fidl_next::Encode<crate::wire::I2cImplOpType<'static>, ___E>,
1924 T2: ::fidl_next::Encode<bool, ___E>,
1925 {
1926 #[inline]
1927 fn encode(
1928 self,
1929 encoder_: &mut ___E,
1930 out_: &mut ::core::mem::MaybeUninit<crate::wire::I2cImplOp<'static>>,
1931 _: (),
1932 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1933 ::fidl_next::munge! {
1934 let crate::wire::I2cImplOp {
1935 address,
1936 type_,
1937 stop,
1938
1939 } = out_;
1940 }
1941
1942 ::fidl_next::Encode::encode(self.address, encoder_, address, ())?;
1943
1944 ::fidl_next::Encode::encode(self.type_, encoder_, type_, ())?;
1945
1946 ::fidl_next::Encode::encode(self.stop, encoder_, stop, ())?;
1947
1948 Ok(())
1949 }
1950 }
1951
1952 pub struct DeviceTransactRequest<T0> {
1954 pub op: T0,
1955 }
1956
1957 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceTransactRequest<'static>, ___E>
1958 for DeviceTransactRequest<T0>
1959 where
1960 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1961 ___E: ::fidl_next::Encoder,
1962 T0: ::fidl_next::Encode<
1963 ::fidl_next::wire::Vector<'static, crate::wire::I2cImplOp<'static>>,
1964 ___E,
1965 >,
1966 {
1967 #[inline]
1968 fn encode(
1969 self,
1970 encoder_: &mut ___E,
1971 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceTransactRequest<'static>>,
1972 _: (),
1973 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1974 ::fidl_next::munge! {
1975 let crate::wire::DeviceTransactRequest {
1976 op,
1977
1978 } = out_;
1979 }
1980
1981 ::fidl_next::Encode::encode(self.op, encoder_, op, (256, ()))?;
1982
1983 Ok(())
1984 }
1985 }
1986
1987 pub struct ReadData<T0> {
1989 pub data: T0,
1990 }
1991
1992 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::ReadData<'static>, ___E> for ReadData<T0>
1993 where
1994 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1995 ___E: ::fidl_next::Encoder,
1996 T0: ::fidl_next::Encode<::fidl_next::wire::Vector<'static, u8>, ___E>,
1997 {
1998 #[inline]
1999 fn encode(
2000 self,
2001 encoder_: &mut ___E,
2002 out_: &mut ::core::mem::MaybeUninit<crate::wire::ReadData<'static>>,
2003 _: (),
2004 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2005 ::fidl_next::munge! {
2006 let crate::wire::ReadData {
2007 data,
2008
2009 } = out_;
2010 }
2011
2012 ::fidl_next::Encode::encode(self.data, encoder_, data, (32768, ()))?;
2013
2014 Ok(())
2015 }
2016 }
2017
2018 pub struct DeviceTransactResponse<T0> {
2020 pub read: T0,
2021 }
2022
2023 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceTransactResponse<'static>, ___E>
2024 for DeviceTransactResponse<T0>
2025 where
2026 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2027 ___E: ::fidl_next::Encoder,
2028 T0: ::fidl_next::Encode<
2029 ::fidl_next::wire::Vector<'static, crate::wire::ReadData<'static>>,
2030 ___E,
2031 >,
2032 {
2033 #[inline]
2034 fn encode(
2035 self,
2036 encoder_: &mut ___E,
2037 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceTransactResponse<'static>>,
2038 _: (),
2039 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2040 ::fidl_next::munge! {
2041 let crate::wire::DeviceTransactResponse {
2042 read,
2043
2044 } = out_;
2045 }
2046
2047 ::fidl_next::Encode::encode(self.read, encoder_, read, (256, ()))?;
2048
2049 Ok(())
2050 }
2051 }
2052}
2053
2054pub use self::natural::*;
2055
2056#[doc = " Low-level protocol for i2c drivers.\n"]
2058#[derive(PartialEq, Debug)]
2059pub struct Device;
2060
2061impl ::fidl_next::Discoverable for Device {
2062 const PROTOCOL_NAME: &'static str = "fuchsia.hardware.i2cimpl.Device";
2063}
2064
2065#[cfg(feature = "driver")]
2066impl ::fidl_next::HasTransport for Device {
2067 type Transport = ::fdf_fidl::DriverChannel;
2068}
2069
2070pub mod device {
2071 pub mod prelude {
2072 pub use crate::{
2073 Device, DeviceClientHandler, DeviceLocalClientHandler, DeviceLocalServerHandler,
2074 DeviceServerHandler, device,
2075 };
2076
2077 pub use crate::natural::DeviceSetBitrateRequest;
2078
2079 pub use crate::natural::DeviceTransactRequest;
2080
2081 pub use crate::natural::DeviceGetMaxTransferSizeResponse;
2082
2083 pub use crate::natural::DeviceSetBitrateResponse;
2084
2085 pub use crate::natural::DeviceTransactResponse;
2086 }
2087
2088 pub struct GetMaxTransferSize;
2089
2090 impl ::fidl_next::Method for GetMaxTransferSize {
2091 const ORDINAL: u64 = 5122675640437495577;
2092 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
2093 ::fidl_next::protocol::Flexibility::Flexible;
2094
2095 type Protocol = crate::Device;
2096
2097 type Request = ::fidl_next::wire::EmptyMessageBody;
2098 }
2099
2100 impl ::fidl_next::TwoWayMethod for GetMaxTransferSize {
2101 type Response = ::fidl_next::wire::Result<
2102 'static,
2103 crate::wire::DeviceGetMaxTransferSizeResponse,
2104 ::fidl_next::wire::fuchsia::Status,
2105 >;
2106 }
2107
2108 impl<___R> ::fidl_next::Respond<___R> for GetMaxTransferSize {
2109 type Output = ::core::result::Result<
2110 crate::generic::DeviceGetMaxTransferSizeResponse<___R>,
2111 ::fidl_next::never::Never,
2112 >;
2113
2114 fn respond(response: ___R) -> Self::Output {
2115 ::core::result::Result::Ok(crate::generic::DeviceGetMaxTransferSizeResponse {
2116 size: response,
2117 })
2118 }
2119 }
2120
2121 impl<___R> ::fidl_next::RespondErr<___R> for GetMaxTransferSize {
2122 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
2123
2124 fn respond_err(response: ___R) -> Self::Output {
2125 ::core::result::Result::Err(response)
2126 }
2127 }
2128
2129 pub struct SetBitrate;
2130
2131 impl ::fidl_next::Method for SetBitrate {
2132 const ORDINAL: u64 = 8193992212524563188;
2133 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
2134 ::fidl_next::protocol::Flexibility::Flexible;
2135
2136 type Protocol = crate::Device;
2137
2138 type Request = crate::wire::DeviceSetBitrateRequest;
2139 }
2140
2141 impl ::fidl_next::TwoWayMethod for SetBitrate {
2142 type Response = ::fidl_next::wire::Result<
2143 'static,
2144 crate::wire::DeviceSetBitrateResponse,
2145 ::fidl_next::wire::fuchsia::Status,
2146 >;
2147 }
2148
2149 impl<___R> ::fidl_next::Respond<___R> for SetBitrate {
2150 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
2151
2152 fn respond(response: ___R) -> Self::Output {
2153 ::core::result::Result::Ok(response)
2154 }
2155 }
2156
2157 impl<___R> ::fidl_next::RespondErr<___R> for SetBitrate {
2158 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
2159
2160 fn respond_err(response: ___R) -> Self::Output {
2161 ::core::result::Result::Err(response)
2162 }
2163 }
2164
2165 pub struct Transact;
2166
2167 impl ::fidl_next::Method for Transact {
2168 const ORDINAL: u64 = 6461839908402215334;
2169 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
2170 ::fidl_next::protocol::Flexibility::Flexible;
2171
2172 type Protocol = crate::Device;
2173
2174 type Request = crate::wire::DeviceTransactRequest<'static>;
2175 }
2176
2177 impl ::fidl_next::TwoWayMethod for Transact {
2178 type Response = ::fidl_next::wire::Result<
2179 'static,
2180 crate::wire::DeviceTransactResponse<'static>,
2181 ::fidl_next::wire::fuchsia::Status,
2182 >;
2183 }
2184
2185 impl<___R> ::fidl_next::Respond<___R> for Transact {
2186 type Output = ::core::result::Result<
2187 crate::generic::DeviceTransactResponse<___R>,
2188 ::fidl_next::never::Never,
2189 >;
2190
2191 fn respond(response: ___R) -> Self::Output {
2192 ::core::result::Result::Ok(crate::generic::DeviceTransactResponse { read: response })
2193 }
2194 }
2195
2196 impl<___R> ::fidl_next::RespondErr<___R> for Transact {
2197 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
2198
2199 fn respond_err(response: ___R) -> Self::Output {
2200 ::core::result::Result::Err(response)
2201 }
2202 }
2203
2204 mod ___detail {
2205 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Device
2206 where
2207 ___T: ::fidl_next::Transport,
2208 {
2209 type Client = DeviceClient<___T>;
2210 type Server = DeviceServer<___T>;
2211 }
2212
2213 #[repr(transparent)]
2215 pub struct DeviceClient<___T: ::fidl_next::Transport> {
2216 #[allow(dead_code)]
2217 client: ::fidl_next::protocol::Client<___T>,
2218 }
2219
2220 impl<___T> DeviceClient<___T>
2221 where
2222 ___T: ::fidl_next::Transport,
2223 {
2224 pub fn get_max_transfer_size(
2225 &self,
2226 ) -> ::fidl_next::TwoWayFuture<'_, super::GetMaxTransferSize, ___T> {
2227 ::fidl_next::TwoWayFuture::from_untyped(
2228 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
2229 5122675640437495577,
2230 <super::GetMaxTransferSize as ::fidl_next::Method>::FLEXIBILITY,
2231 (),
2232 ),
2233 )
2234 }
2235
2236 #[doc = " Sets the bitrate for the i2c bus in KHz units.\n"]
2237 pub fn set_bitrate(
2238 &self,
2239
2240 bitrate: impl ::fidl_next::Encode<
2241 ::fidl_next::wire::Uint32,
2242 <___T as ::fidl_next::Transport>::SendBuffer,
2243 >,
2244 ) -> ::fidl_next::TwoWayFuture<'_, super::SetBitrate, ___T>
2245 where
2246 <___T as ::fidl_next::Transport>::SendBuffer:
2247 ::fidl_next::encoder::InternalHandleEncoder,
2248 {
2249 self.set_bitrate_with(crate::generic::DeviceSetBitrateRequest { bitrate })
2250 }
2251
2252 #[doc = " Sets the bitrate for the i2c bus in KHz units.\n"]
2253 pub fn set_bitrate_with<___R>(
2254 &self,
2255 request: ___R,
2256 ) -> ::fidl_next::TwoWayFuture<'_, super::SetBitrate, ___T>
2257 where
2258 ___R: ::fidl_next::Encode<
2259 crate::wire::DeviceSetBitrateRequest,
2260 <___T as ::fidl_next::Transport>::SendBuffer,
2261 >,
2262 {
2263 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
2264 8193992212524563188,
2265 <super::SetBitrate as ::fidl_next::Method>::FLEXIBILITY,
2266 request,
2267 ))
2268 }
2269
2270 #[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"]
2271 pub fn transact(
2272 &self,
2273
2274 op: impl ::fidl_next::Encode<
2275 ::fidl_next::wire::Vector<'static, crate::wire::I2cImplOp<'static>>,
2276 <___T as ::fidl_next::Transport>::SendBuffer,
2277 >,
2278 ) -> ::fidl_next::TwoWayFuture<'_, super::Transact, ___T>
2279 where
2280 <___T as ::fidl_next::Transport>::SendBuffer:
2281 ::fidl_next::encoder::InternalHandleEncoder,
2282 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
2283 {
2284 self.transact_with(crate::generic::DeviceTransactRequest { op })
2285 }
2286
2287 #[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"]
2288 pub fn transact_with<___R>(
2289 &self,
2290 request: ___R,
2291 ) -> ::fidl_next::TwoWayFuture<'_, super::Transact, ___T>
2292 where
2293 ___R: ::fidl_next::Encode<
2294 crate::wire::DeviceTransactRequest<'static>,
2295 <___T as ::fidl_next::Transport>::SendBuffer,
2296 >,
2297 {
2298 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
2299 6461839908402215334,
2300 <super::Transact as ::fidl_next::Method>::FLEXIBILITY,
2301 request,
2302 ))
2303 }
2304 }
2305
2306 #[repr(transparent)]
2308 pub struct DeviceServer<___T: ::fidl_next::Transport> {
2309 server: ::fidl_next::protocol::Server<___T>,
2310 }
2311
2312 impl<___T> DeviceServer<___T> where ___T: ::fidl_next::Transport {}
2313 }
2314}
2315
2316#[diagnostic::on_unimplemented(
2317 note = "If {Self} implements the non-local DeviceClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
2318)]
2319
2320pub trait DeviceLocalClientHandler<
2324 #[cfg(feature = "driver")] ___T: ::fidl_next::Transport = ::fdf_fidl::DriverChannel,
2325 #[cfg(not(feature = "driver"))] ___T: ::fidl_next::Transport,
2326>
2327{
2328 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
2329 ::core::future::ready(())
2330 }
2331}
2332
2333impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Device
2334where
2335 ___H: DeviceLocalClientHandler<___T>,
2336 ___T: ::fidl_next::Transport,
2337{
2338 async fn on_event(
2339 handler: &mut ___H,
2340 mut message: ::fidl_next::Message<___T>,
2341 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
2342 match *message.header().ordinal {
2343 ordinal => {
2344 handler.on_unknown_interaction(ordinal).await;
2345 if ::core::matches!(
2346 message.header().flexibility(),
2347 ::fidl_next::protocol::Flexibility::Strict
2348 ) {
2349 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2350 } else {
2351 Ok(())
2352 }
2353 }
2354 }
2355 }
2356}
2357
2358#[diagnostic::on_unimplemented(
2359 note = "If {Self} implements the non-local DeviceServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
2360)]
2361
2362pub trait DeviceLocalServerHandler<
2366 #[cfg(feature = "driver")] ___T: ::fidl_next::Transport = ::fdf_fidl::DriverChannel,
2367 #[cfg(not(feature = "driver"))] ___T: ::fidl_next::Transport,
2368>
2369{
2370 fn get_max_transfer_size(
2371 &mut self,
2372
2373 responder: ::fidl_next::Responder<device::GetMaxTransferSize, ___T>,
2374 ) -> impl ::core::future::Future<Output = ()>;
2375
2376 #[doc = " Sets the bitrate for the i2c bus in KHz units.\n"]
2377 fn set_bitrate(
2378 &mut self,
2379
2380 request: ::fidl_next::Request<device::SetBitrate, ___T>,
2381
2382 responder: ::fidl_next::Responder<device::SetBitrate, ___T>,
2383 ) -> impl ::core::future::Future<Output = ()>;
2384
2385 #[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"]
2386 fn transact(
2387 &mut self,
2388
2389 request: ::fidl_next::Request<device::Transact, ___T>,
2390
2391 responder: ::fidl_next::Responder<device::Transact, ___T>,
2392 ) -> impl ::core::future::Future<Output = ()>;
2393
2394 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
2395 ::core::future::ready(())
2396 }
2397}
2398
2399impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Device
2400where
2401 ___H: DeviceLocalServerHandler<___T>,
2402 ___T: ::fidl_next::Transport,
2403 for<'de> crate::wire::DeviceSetBitrateRequest: ::fidl_next::Decode<
2404 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2405 Constraint = (),
2406 >,
2407 for<'de> crate::wire::DeviceTransactRequest<'de>: ::fidl_next::Decode<
2408 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2409 Constraint = (),
2410 >,
2411{
2412 async fn on_one_way(
2413 handler: &mut ___H,
2414 mut message: ::fidl_next::Message<___T>,
2415 ) -> ::core::result::Result<
2416 (),
2417 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
2418 > {
2419 match *message.header().ordinal {
2420 ordinal => {
2421 handler.on_unknown_interaction(ordinal).await;
2422 if ::core::matches!(
2423 message.header().flexibility(),
2424 ::fidl_next::protocol::Flexibility::Strict
2425 ) {
2426 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2427 } else {
2428 Ok(())
2429 }
2430 }
2431 }
2432 }
2433
2434 async fn on_two_way(
2435 handler: &mut ___H,
2436 mut message: ::fidl_next::Message<___T>,
2437 responder: ::fidl_next::protocol::Responder<___T>,
2438 ) -> ::core::result::Result<
2439 (),
2440 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
2441 > {
2442 match *message.header().ordinal {
2443 5122675640437495577 => {
2444 let responder = ::fidl_next::Responder::from_untyped(responder);
2445
2446 handler.get_max_transfer_size(responder).await;
2447 Ok(())
2448 }
2449
2450 8193992212524563188 => {
2451 let responder = ::fidl_next::Responder::from_untyped(responder);
2452
2453 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2454 Ok(decoded) => {
2455 handler
2456 .set_bitrate(::fidl_next::Request::from_decoded(decoded), responder)
2457 .await;
2458 Ok(())
2459 }
2460 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2461 ordinal: 8193992212524563188,
2462 error,
2463 }),
2464 }
2465 }
2466
2467 6461839908402215334 => {
2468 let responder = ::fidl_next::Responder::from_untyped(responder);
2469
2470 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2471 Ok(decoded) => {
2472 handler
2473 .transact(::fidl_next::Request::from_decoded(decoded), responder)
2474 .await;
2475 Ok(())
2476 }
2477 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2478 ordinal: 6461839908402215334,
2479 error,
2480 }),
2481 }
2482 }
2483
2484 ordinal => {
2485 handler.on_unknown_interaction(ordinal).await;
2486 if ::core::matches!(
2487 message.header().flexibility(),
2488 ::fidl_next::protocol::Flexibility::Strict
2489 ) {
2490 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2491 } else {
2492 responder
2493 .respond_framework_error(
2494 ordinal,
2495 ::fidl_next::FrameworkError::UnknownMethod,
2496 )
2497 .expect("encoding a framework error should never fail")
2498 .await?;
2499 Ok(())
2500 }
2501 }
2502 }
2503 }
2504}
2505
2506pub trait DeviceClientHandler<
2510 #[cfg(feature = "driver")] ___T: ::fidl_next::Transport = ::fdf_fidl::DriverChannel,
2511 #[cfg(not(feature = "driver"))] ___T: ::fidl_next::Transport,
2512>
2513{
2514 fn on_unknown_interaction(
2515 &mut self,
2516 ordinal: u64,
2517 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
2518 ::core::future::ready(())
2519 }
2520}
2521
2522impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Device
2523where
2524 ___H: DeviceClientHandler<___T> + ::core::marker::Send,
2525 ___T: ::fidl_next::Transport,
2526{
2527 async fn on_event(
2528 handler: &mut ___H,
2529 mut message: ::fidl_next::Message<___T>,
2530 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
2531 match *message.header().ordinal {
2532 ordinal => {
2533 handler.on_unknown_interaction(ordinal).await;
2534 if ::core::matches!(
2535 message.header().flexibility(),
2536 ::fidl_next::protocol::Flexibility::Strict
2537 ) {
2538 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2539 } else {
2540 Ok(())
2541 }
2542 }
2543 }
2544 }
2545}
2546
2547pub trait DeviceServerHandler<
2551 #[cfg(feature = "driver")] ___T: ::fidl_next::Transport = ::fdf_fidl::DriverChannel,
2552 #[cfg(not(feature = "driver"))] ___T: ::fidl_next::Transport,
2553>
2554{
2555 fn get_max_transfer_size(
2556 &mut self,
2557
2558 responder: ::fidl_next::Responder<device::GetMaxTransferSize, ___T>,
2559 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2560
2561 #[doc = " Sets the bitrate for the i2c bus in KHz units.\n"]
2562 fn set_bitrate(
2563 &mut self,
2564
2565 request: ::fidl_next::Request<device::SetBitrate, ___T>,
2566
2567 responder: ::fidl_next::Responder<device::SetBitrate, ___T>,
2568 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2569
2570 #[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"]
2571 fn transact(
2572 &mut self,
2573
2574 request: ::fidl_next::Request<device::Transact, ___T>,
2575
2576 responder: ::fidl_next::Responder<device::Transact, ___T>,
2577 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2578
2579 fn on_unknown_interaction(
2580 &mut self,
2581 ordinal: u64,
2582 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
2583 ::core::future::ready(())
2584 }
2585}
2586
2587impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Device
2588where
2589 ___H: DeviceServerHandler<___T> + ::core::marker::Send,
2590 ___T: ::fidl_next::Transport,
2591 for<'de> crate::wire::DeviceSetBitrateRequest: ::fidl_next::Decode<
2592 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2593 Constraint = (),
2594 >,
2595 for<'de> crate::wire::DeviceTransactRequest<'de>: ::fidl_next::Decode<
2596 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2597 Constraint = (),
2598 >,
2599{
2600 async fn on_one_way(
2601 handler: &mut ___H,
2602 mut message: ::fidl_next::Message<___T>,
2603 ) -> ::core::result::Result<
2604 (),
2605 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
2606 > {
2607 match *message.header().ordinal {
2608 ordinal => {
2609 handler.on_unknown_interaction(ordinal).await;
2610 if ::core::matches!(
2611 message.header().flexibility(),
2612 ::fidl_next::protocol::Flexibility::Strict
2613 ) {
2614 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2615 } else {
2616 Ok(())
2617 }
2618 }
2619 }
2620 }
2621
2622 async fn on_two_way(
2623 handler: &mut ___H,
2624 mut message: ::fidl_next::Message<___T>,
2625 responder: ::fidl_next::protocol::Responder<___T>,
2626 ) -> ::core::result::Result<
2627 (),
2628 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
2629 > {
2630 match *message.header().ordinal {
2631 5122675640437495577 => {
2632 let responder = ::fidl_next::Responder::from_untyped(responder);
2633
2634 handler.get_max_transfer_size(responder).await;
2635 Ok(())
2636 }
2637
2638 8193992212524563188 => {
2639 let responder = ::fidl_next::Responder::from_untyped(responder);
2640
2641 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2642 Ok(decoded) => {
2643 handler
2644 .set_bitrate(::fidl_next::Request::from_decoded(decoded), responder)
2645 .await;
2646 Ok(())
2647 }
2648 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2649 ordinal: 8193992212524563188,
2650 error,
2651 }),
2652 }
2653 }
2654
2655 6461839908402215334 => {
2656 let responder = ::fidl_next::Responder::from_untyped(responder);
2657
2658 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2659 Ok(decoded) => {
2660 handler
2661 .transact(::fidl_next::Request::from_decoded(decoded), responder)
2662 .await;
2663 Ok(())
2664 }
2665 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2666 ordinal: 6461839908402215334,
2667 error,
2668 }),
2669 }
2670 }
2671
2672 ordinal => {
2673 handler.on_unknown_interaction(ordinal).await;
2674 if ::core::matches!(
2675 message.header().flexibility(),
2676 ::fidl_next::protocol::Flexibility::Strict
2677 ) {
2678 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2679 } else {
2680 responder
2681 .respond_framework_error(
2682 ordinal,
2683 ::fidl_next::FrameworkError::UnknownMethod,
2684 )
2685 .expect("encoding a framework error should never fail")
2686 .await?;
2687 Ok(())
2688 }
2689 }
2690 }
2691 }
2692}
2693
2694impl<___T> DeviceClientHandler<___T> for ::fidl_next::IgnoreEvents
2695where
2696 ___T: ::fidl_next::Transport,
2697{
2698 async fn on_unknown_interaction(&mut self, _: u64) {}
2699}
2700
2701impl<___H, ___T> DeviceLocalClientHandler<___T> for ::fidl_next::Local<___H>
2702where
2703 ___H: DeviceClientHandler<___T>,
2704 ___T: ::fidl_next::Transport,
2705{
2706 async fn on_unknown_interaction(&mut self, ordinal: u64) {
2707 ___H::on_unknown_interaction(&mut self.0, ordinal).await
2708 }
2709}
2710
2711impl<___H, ___T> DeviceLocalServerHandler<___T> for ::fidl_next::Local<___H>
2712where
2713 ___H: DeviceServerHandler<___T>,
2714 ___T: ::fidl_next::Transport,
2715{
2716 async fn get_max_transfer_size(
2717 &mut self,
2718
2719 responder: ::fidl_next::Responder<device::GetMaxTransferSize, ___T>,
2720 ) {
2721 ___H::get_max_transfer_size(&mut self.0, responder).await
2722 }
2723
2724 async fn set_bitrate(
2725 &mut self,
2726
2727 request: ::fidl_next::Request<device::SetBitrate, ___T>,
2728
2729 responder: ::fidl_next::Responder<device::SetBitrate, ___T>,
2730 ) {
2731 ___H::set_bitrate(&mut self.0, request, responder).await
2732 }
2733
2734 async fn transact(
2735 &mut self,
2736
2737 request: ::fidl_next::Request<device::Transact, ___T>,
2738
2739 responder: ::fidl_next::Responder<device::Transact, ___T>,
2740 ) {
2741 ___H::transact(&mut self.0, request, responder).await
2742 }
2743
2744 async fn on_unknown_interaction(&mut self, ordinal: u64) {
2745 ___H::on_unknown_interaction(&mut self.0, ordinal).await
2746 }
2747}