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 unsafe impl<'a, ___E, T0>
1875 ::fidl_next::Encode<crate::wire::DeviceGetMaxTransferSizeResponse, ___E>
1876 for &'a DeviceGetMaxTransferSizeResponse<T0>
1877 where
1878 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1879 &'a T0: ::fidl_next::Encode<::fidl_next::wire::Uint64, ___E>,
1880 {
1881 #[inline]
1882 fn encode(
1883 self,
1884 encoder_: &mut ___E,
1885 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetMaxTransferSizeResponse>,
1886 _: (),
1887 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1888 ::fidl_next::munge! {
1889 let crate::wire::DeviceGetMaxTransferSizeResponse {
1890 size,
1891
1892 } = out_;
1893 }
1894
1895 ::fidl_next::Encode::encode(&self.size, encoder_, size, ())?;
1896
1897 Ok(())
1898 }
1899 }
1900
1901 pub struct DeviceSetBitrateRequest<T0> {
1903 pub bitrate: T0,
1904 }
1905
1906 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceSetBitrateRequest, ___E>
1907 for DeviceSetBitrateRequest<T0>
1908 where
1909 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1910 T0: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
1911 {
1912 #[inline]
1913 fn encode(
1914 self,
1915 encoder_: &mut ___E,
1916 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceSetBitrateRequest>,
1917 _: (),
1918 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1919 ::fidl_next::munge! {
1920 let crate::wire::DeviceSetBitrateRequest {
1921 bitrate,
1922
1923 } = out_;
1924 }
1925
1926 ::fidl_next::Encode::encode(self.bitrate, encoder_, bitrate, ())?;
1927
1928 Ok(())
1929 }
1930 }
1931
1932 unsafe impl<'a, ___E, T0> ::fidl_next::Encode<crate::wire::DeviceSetBitrateRequest, ___E>
1933 for &'a DeviceSetBitrateRequest<T0>
1934 where
1935 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1936 &'a T0: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
1937 {
1938 #[inline]
1939 fn encode(
1940 self,
1941 encoder_: &mut ___E,
1942 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceSetBitrateRequest>,
1943 _: (),
1944 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1945 ::fidl_next::munge! {
1946 let crate::wire::DeviceSetBitrateRequest {
1947 bitrate,
1948
1949 } = out_;
1950 }
1951
1952 ::fidl_next::Encode::encode(&self.bitrate, encoder_, bitrate, ())?;
1953
1954 Ok(())
1955 }
1956 }
1957
1958 pub type DeviceSetBitrateResponse = ();
1960
1961 pub struct I2cImplOp<T0, T1, T2> {
1963 pub address: T0,
1964
1965 pub type_: T1,
1966
1967 pub stop: T2,
1968 }
1969
1970 unsafe impl<___E, T0, T1, T2> ::fidl_next::Encode<crate::wire::I2cImplOp<'static>, ___E>
1971 for I2cImplOp<T0, T1, T2>
1972 where
1973 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1974 ___E: ::fidl_next::Encoder,
1975 T0: ::fidl_next::Encode<::fidl_next::wire::Uint16, ___E>,
1976 T1: ::fidl_next::Encode<crate::wire::I2cImplOpType<'static>, ___E>,
1977 T2: ::fidl_next::Encode<bool, ___E>,
1978 {
1979 #[inline]
1980 fn encode(
1981 self,
1982 encoder_: &mut ___E,
1983 out_: &mut ::core::mem::MaybeUninit<crate::wire::I2cImplOp<'static>>,
1984 _: (),
1985 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1986 ::fidl_next::munge! {
1987 let crate::wire::I2cImplOp {
1988 address,
1989 type_,
1990 stop,
1991
1992 } = out_;
1993 }
1994
1995 ::fidl_next::Encode::encode(self.address, encoder_, address, ())?;
1996
1997 ::fidl_next::Encode::encode(self.type_, encoder_, type_, ())?;
1998
1999 ::fidl_next::Encode::encode(self.stop, encoder_, stop, ())?;
2000
2001 Ok(())
2002 }
2003 }
2004
2005 unsafe impl<'a, ___E, T0, T1, T2> ::fidl_next::Encode<crate::wire::I2cImplOp<'static>, ___E>
2006 for &'a I2cImplOp<T0, T1, T2>
2007 where
2008 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2009 ___E: ::fidl_next::Encoder,
2010 &'a T0: ::fidl_next::Encode<::fidl_next::wire::Uint16, ___E>,
2011 &'a T1: ::fidl_next::Encode<crate::wire::I2cImplOpType<'static>, ___E>,
2012 &'a T2: ::fidl_next::Encode<bool, ___E>,
2013 {
2014 #[inline]
2015 fn encode(
2016 self,
2017 encoder_: &mut ___E,
2018 out_: &mut ::core::mem::MaybeUninit<crate::wire::I2cImplOp<'static>>,
2019 _: (),
2020 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2021 ::fidl_next::munge! {
2022 let crate::wire::I2cImplOp {
2023 address,
2024 type_,
2025 stop,
2026
2027 } = out_;
2028 }
2029
2030 ::fidl_next::Encode::encode(&self.address, encoder_, address, ())?;
2031
2032 ::fidl_next::Encode::encode(&self.type_, encoder_, type_, ())?;
2033
2034 ::fidl_next::Encode::encode(&self.stop, encoder_, stop, ())?;
2035
2036 Ok(())
2037 }
2038 }
2039
2040 pub struct DeviceTransactRequest<T0> {
2042 pub op: T0,
2043 }
2044
2045 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceTransactRequest<'static>, ___E>
2046 for DeviceTransactRequest<T0>
2047 where
2048 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2049 ___E: ::fidl_next::Encoder,
2050 T0: ::fidl_next::Encode<
2051 ::fidl_next::wire::Vector<'static, crate::wire::I2cImplOp<'static>>,
2052 ___E,
2053 >,
2054 {
2055 #[inline]
2056 fn encode(
2057 self,
2058 encoder_: &mut ___E,
2059 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceTransactRequest<'static>>,
2060 _: (),
2061 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2062 ::fidl_next::munge! {
2063 let crate::wire::DeviceTransactRequest {
2064 op,
2065
2066 } = out_;
2067 }
2068
2069 ::fidl_next::Encode::encode(self.op, encoder_, op, (256, ()))?;
2070
2071 Ok(())
2072 }
2073 }
2074
2075 unsafe impl<'a, ___E, T0> ::fidl_next::Encode<crate::wire::DeviceTransactRequest<'static>, ___E>
2076 for &'a DeviceTransactRequest<T0>
2077 where
2078 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2079 ___E: ::fidl_next::Encoder,
2080 &'a T0: ::fidl_next::Encode<
2081 ::fidl_next::wire::Vector<'static, crate::wire::I2cImplOp<'static>>,
2082 ___E,
2083 >,
2084 {
2085 #[inline]
2086 fn encode(
2087 self,
2088 encoder_: &mut ___E,
2089 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceTransactRequest<'static>>,
2090 _: (),
2091 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2092 ::fidl_next::munge! {
2093 let crate::wire::DeviceTransactRequest {
2094 op,
2095
2096 } = out_;
2097 }
2098
2099 ::fidl_next::Encode::encode(&self.op, encoder_, op, (256, ()))?;
2100
2101 Ok(())
2102 }
2103 }
2104
2105 pub struct ReadData<T0> {
2107 pub data: T0,
2108 }
2109
2110 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::ReadData<'static>, ___E> for ReadData<T0>
2111 where
2112 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2113 ___E: ::fidl_next::Encoder,
2114 T0: ::fidl_next::Encode<::fidl_next::wire::Vector<'static, u8>, ___E>,
2115 {
2116 #[inline]
2117 fn encode(
2118 self,
2119 encoder_: &mut ___E,
2120 out_: &mut ::core::mem::MaybeUninit<crate::wire::ReadData<'static>>,
2121 _: (),
2122 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2123 ::fidl_next::munge! {
2124 let crate::wire::ReadData {
2125 data,
2126
2127 } = out_;
2128 }
2129
2130 ::fidl_next::Encode::encode(self.data, encoder_, data, (32768, ()))?;
2131
2132 Ok(())
2133 }
2134 }
2135
2136 unsafe impl<'a, ___E, T0> ::fidl_next::Encode<crate::wire::ReadData<'static>, ___E>
2137 for &'a ReadData<T0>
2138 where
2139 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2140 ___E: ::fidl_next::Encoder,
2141 &'a T0: ::fidl_next::Encode<::fidl_next::wire::Vector<'static, u8>, ___E>,
2142 {
2143 #[inline]
2144 fn encode(
2145 self,
2146 encoder_: &mut ___E,
2147 out_: &mut ::core::mem::MaybeUninit<crate::wire::ReadData<'static>>,
2148 _: (),
2149 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2150 ::fidl_next::munge! {
2151 let crate::wire::ReadData {
2152 data,
2153
2154 } = out_;
2155 }
2156
2157 ::fidl_next::Encode::encode(&self.data, encoder_, data, (32768, ()))?;
2158
2159 Ok(())
2160 }
2161 }
2162
2163 pub struct DeviceTransactResponse<T0> {
2165 pub read: T0,
2166 }
2167
2168 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceTransactResponse<'static>, ___E>
2169 for DeviceTransactResponse<T0>
2170 where
2171 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2172 ___E: ::fidl_next::Encoder,
2173 T0: ::fidl_next::Encode<
2174 ::fidl_next::wire::Vector<'static, crate::wire::ReadData<'static>>,
2175 ___E,
2176 >,
2177 {
2178 #[inline]
2179 fn encode(
2180 self,
2181 encoder_: &mut ___E,
2182 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceTransactResponse<'static>>,
2183 _: (),
2184 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2185 ::fidl_next::munge! {
2186 let crate::wire::DeviceTransactResponse {
2187 read,
2188
2189 } = out_;
2190 }
2191
2192 ::fidl_next::Encode::encode(self.read, encoder_, read, (256, ()))?;
2193
2194 Ok(())
2195 }
2196 }
2197
2198 unsafe impl<'a, ___E, T0>
2199 ::fidl_next::Encode<crate::wire::DeviceTransactResponse<'static>, ___E>
2200 for &'a DeviceTransactResponse<T0>
2201 where
2202 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2203 ___E: ::fidl_next::Encoder,
2204 &'a T0: ::fidl_next::Encode<
2205 ::fidl_next::wire::Vector<'static, crate::wire::ReadData<'static>>,
2206 ___E,
2207 >,
2208 {
2209 #[inline]
2210 fn encode(
2211 self,
2212 encoder_: &mut ___E,
2213 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceTransactResponse<'static>>,
2214 _: (),
2215 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2216 ::fidl_next::munge! {
2217 let crate::wire::DeviceTransactResponse {
2218 read,
2219
2220 } = out_;
2221 }
2222
2223 ::fidl_next::Encode::encode(&self.read, encoder_, read, (256, ()))?;
2224
2225 Ok(())
2226 }
2227 }
2228}
2229
2230pub use self::natural::*;
2231
2232#[doc = " Low-level protocol for i2c drivers.\n"]
2234#[derive(PartialEq, Debug)]
2235pub struct Device;
2236
2237impl ::fidl_next::Discoverable for Device {
2238 const PROTOCOL_NAME: &'static str = "fuchsia.hardware.i2cimpl.Device";
2239}
2240
2241#[cfg(feature = "driver")]
2242impl ::fidl_next::HasTransport for Device {
2243 type Transport = ::fdf_fidl::DriverChannel;
2244}
2245
2246pub mod device {
2247 pub mod prelude {
2248 pub use crate::{
2249 Device, DeviceClientHandler, DeviceLocalClientHandler, DeviceLocalServerHandler,
2250 DeviceServerHandler, device,
2251 };
2252
2253 pub use crate::natural::DeviceSetBitrateRequest;
2254
2255 pub use crate::natural::DeviceTransactRequest;
2256
2257 pub use crate::natural::DeviceGetMaxTransferSizeResponse;
2258
2259 pub use crate::natural::DeviceSetBitrateResponse;
2260
2261 pub use crate::natural::DeviceTransactResponse;
2262 }
2263
2264 pub struct GetMaxTransferSize;
2265
2266 impl ::fidl_next::Method for GetMaxTransferSize {
2267 const ORDINAL: u64 = 5122675640437495577;
2268 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
2269 ::fidl_next::protocol::Flexibility::Flexible;
2270
2271 type Protocol = crate::Device;
2272
2273 type Request = ::fidl_next::wire::EmptyMessageBody;
2274 }
2275
2276 impl ::fidl_next::TwoWayMethod for GetMaxTransferSize {
2277 type Response = ::fidl_next::wire::Result<
2278 'static,
2279 crate::wire::DeviceGetMaxTransferSizeResponse,
2280 ::fidl_next::wire::fuchsia::Status,
2281 >;
2282 }
2283
2284 impl<___R> ::fidl_next::Respond<___R> for GetMaxTransferSize {
2285 type Output = ::core::result::Result<
2286 crate::generic::DeviceGetMaxTransferSizeResponse<___R>,
2287 ::fidl_next::never::Never,
2288 >;
2289
2290 fn respond(response: ___R) -> Self::Output {
2291 ::core::result::Result::Ok(crate::generic::DeviceGetMaxTransferSizeResponse {
2292 size: response,
2293 })
2294 }
2295 }
2296
2297 impl<___R> ::fidl_next::RespondErr<___R> for GetMaxTransferSize {
2298 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
2299
2300 fn respond_err(response: ___R) -> Self::Output {
2301 ::core::result::Result::Err(response)
2302 }
2303 }
2304
2305 pub struct SetBitrate;
2306
2307 impl ::fidl_next::Method for SetBitrate {
2308 const ORDINAL: u64 = 8193992212524563188;
2309 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
2310 ::fidl_next::protocol::Flexibility::Flexible;
2311
2312 type Protocol = crate::Device;
2313
2314 type Request = crate::wire::DeviceSetBitrateRequest;
2315 }
2316
2317 impl ::fidl_next::TwoWayMethod for SetBitrate {
2318 type Response = ::fidl_next::wire::Result<
2319 'static,
2320 crate::wire::DeviceSetBitrateResponse,
2321 ::fidl_next::wire::fuchsia::Status,
2322 >;
2323 }
2324
2325 impl<___R> ::fidl_next::Respond<___R> for SetBitrate {
2326 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
2327
2328 fn respond(response: ___R) -> Self::Output {
2329 ::core::result::Result::Ok(response)
2330 }
2331 }
2332
2333 impl<___R> ::fidl_next::RespondErr<___R> for SetBitrate {
2334 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
2335
2336 fn respond_err(response: ___R) -> Self::Output {
2337 ::core::result::Result::Err(response)
2338 }
2339 }
2340
2341 pub struct Transact;
2342
2343 impl ::fidl_next::Method for Transact {
2344 const ORDINAL: u64 = 6461839908402215334;
2345 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
2346 ::fidl_next::protocol::Flexibility::Flexible;
2347
2348 type Protocol = crate::Device;
2349
2350 type Request = crate::wire::DeviceTransactRequest<'static>;
2351 }
2352
2353 impl ::fidl_next::TwoWayMethod for Transact {
2354 type Response = ::fidl_next::wire::Result<
2355 'static,
2356 crate::wire::DeviceTransactResponse<'static>,
2357 ::fidl_next::wire::fuchsia::Status,
2358 >;
2359 }
2360
2361 impl<___R> ::fidl_next::Respond<___R> for Transact {
2362 type Output = ::core::result::Result<
2363 crate::generic::DeviceTransactResponse<___R>,
2364 ::fidl_next::never::Never,
2365 >;
2366
2367 fn respond(response: ___R) -> Self::Output {
2368 ::core::result::Result::Ok(crate::generic::DeviceTransactResponse { read: response })
2369 }
2370 }
2371
2372 impl<___R> ::fidl_next::RespondErr<___R> for Transact {
2373 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
2374
2375 fn respond_err(response: ___R) -> Self::Output {
2376 ::core::result::Result::Err(response)
2377 }
2378 }
2379
2380 mod ___detail {
2381 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Device
2382 where
2383 ___T: ::fidl_next::Transport,
2384 {
2385 type Client = DeviceClient<___T>;
2386 type Server = DeviceServer<___T>;
2387 }
2388
2389 #[repr(transparent)]
2391 pub struct DeviceClient<___T: ::fidl_next::Transport> {
2392 #[allow(dead_code)]
2393 client: ::fidl_next::protocol::Client<___T>,
2394 }
2395
2396 impl<___T> DeviceClient<___T>
2397 where
2398 ___T: ::fidl_next::Transport,
2399 {
2400 pub fn get_max_transfer_size(
2401 &self,
2402 ) -> ::fidl_next::TwoWayFuture<'_, super::GetMaxTransferSize, ___T> {
2403 ::fidl_next::TwoWayFuture::from_untyped(
2404 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
2405 5122675640437495577,
2406 <super::GetMaxTransferSize as ::fidl_next::Method>::FLEXIBILITY,
2407 (),
2408 ),
2409 )
2410 }
2411
2412 #[doc = " Sets the bitrate for the i2c bus in KHz units.\n"]
2413 pub fn set_bitrate(
2414 &self,
2415
2416 bitrate: impl ::fidl_next::Encode<
2417 ::fidl_next::wire::Uint32,
2418 <___T as ::fidl_next::Transport>::SendBuffer,
2419 >,
2420 ) -> ::fidl_next::TwoWayFuture<'_, super::SetBitrate, ___T>
2421 where
2422 <___T as ::fidl_next::Transport>::SendBuffer:
2423 ::fidl_next::encoder::InternalHandleEncoder,
2424 {
2425 self.set_bitrate_with(crate::generic::DeviceSetBitrateRequest { bitrate })
2426 }
2427
2428 #[doc = " Sets the bitrate for the i2c bus in KHz units.\n"]
2429 pub fn set_bitrate_with<___R>(
2430 &self,
2431 request: ___R,
2432 ) -> ::fidl_next::TwoWayFuture<'_, super::SetBitrate, ___T>
2433 where
2434 ___R: ::fidl_next::Encode<
2435 crate::wire::DeviceSetBitrateRequest,
2436 <___T as ::fidl_next::Transport>::SendBuffer,
2437 >,
2438 {
2439 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
2440 8193992212524563188,
2441 <super::SetBitrate as ::fidl_next::Method>::FLEXIBILITY,
2442 request,
2443 ))
2444 }
2445
2446 #[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"]
2447 pub fn transact(
2448 &self,
2449
2450 op: impl ::fidl_next::Encode<
2451 ::fidl_next::wire::Vector<'static, crate::wire::I2cImplOp<'static>>,
2452 <___T as ::fidl_next::Transport>::SendBuffer,
2453 >,
2454 ) -> ::fidl_next::TwoWayFuture<'_, super::Transact, ___T>
2455 where
2456 <___T as ::fidl_next::Transport>::SendBuffer:
2457 ::fidl_next::encoder::InternalHandleEncoder,
2458 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
2459 {
2460 self.transact_with(crate::generic::DeviceTransactRequest { op })
2461 }
2462
2463 #[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"]
2464 pub fn transact_with<___R>(
2465 &self,
2466 request: ___R,
2467 ) -> ::fidl_next::TwoWayFuture<'_, super::Transact, ___T>
2468 where
2469 ___R: ::fidl_next::Encode<
2470 crate::wire::DeviceTransactRequest<'static>,
2471 <___T as ::fidl_next::Transport>::SendBuffer,
2472 >,
2473 {
2474 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
2475 6461839908402215334,
2476 <super::Transact as ::fidl_next::Method>::FLEXIBILITY,
2477 request,
2478 ))
2479 }
2480 }
2481
2482 #[repr(transparent)]
2484 pub struct DeviceServer<___T: ::fidl_next::Transport> {
2485 server: ::fidl_next::protocol::Server<___T>,
2486 }
2487
2488 impl<___T> DeviceServer<___T> where ___T: ::fidl_next::Transport {}
2489 }
2490}
2491
2492#[diagnostic::on_unimplemented(
2493 note = "If {Self} implements the non-local DeviceClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
2494)]
2495
2496pub trait DeviceLocalClientHandler<
2500 #[cfg(feature = "driver")] ___T: ::fidl_next::Transport = ::fdf_fidl::DriverChannel,
2501 #[cfg(not(feature = "driver"))] ___T: ::fidl_next::Transport,
2502>
2503{
2504 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
2505 ::core::future::ready(())
2506 }
2507}
2508
2509impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Device
2510where
2511 ___H: DeviceLocalClientHandler<___T>,
2512 ___T: ::fidl_next::Transport,
2513{
2514 async fn on_event(
2515 handler: &mut ___H,
2516 mut message: ::fidl_next::Message<___T>,
2517 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
2518 match *message.header().ordinal {
2519 ordinal => {
2520 handler.on_unknown_interaction(ordinal).await;
2521 if ::core::matches!(
2522 message.header().flexibility(),
2523 ::fidl_next::protocol::Flexibility::Strict
2524 ) {
2525 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2526 } else {
2527 Ok(())
2528 }
2529 }
2530 }
2531 }
2532}
2533
2534#[diagnostic::on_unimplemented(
2535 note = "If {Self} implements the non-local DeviceServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
2536)]
2537
2538pub trait DeviceLocalServerHandler<
2542 #[cfg(feature = "driver")] ___T: ::fidl_next::Transport = ::fdf_fidl::DriverChannel,
2543 #[cfg(not(feature = "driver"))] ___T: ::fidl_next::Transport,
2544>
2545{
2546 fn get_max_transfer_size(
2547 &mut self,
2548
2549 responder: ::fidl_next::Responder<device::GetMaxTransferSize, ___T>,
2550 ) -> impl ::core::future::Future<Output = ()>;
2551
2552 #[doc = " Sets the bitrate for the i2c bus in KHz units.\n"]
2553 fn set_bitrate(
2554 &mut self,
2555
2556 request: ::fidl_next::Request<device::SetBitrate, ___T>,
2557
2558 responder: ::fidl_next::Responder<device::SetBitrate, ___T>,
2559 ) -> impl ::core::future::Future<Output = ()>;
2560
2561 #[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"]
2562 fn transact(
2563 &mut self,
2564
2565 request: ::fidl_next::Request<device::Transact, ___T>,
2566
2567 responder: ::fidl_next::Responder<device::Transact, ___T>,
2568 ) -> impl ::core::future::Future<Output = ()>;
2569
2570 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
2571 ::core::future::ready(())
2572 }
2573}
2574
2575impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Device
2576where
2577 ___H: DeviceLocalServerHandler<___T>,
2578 ___T: ::fidl_next::Transport,
2579 for<'de> crate::wire::DeviceSetBitrateRequest: ::fidl_next::Decode<
2580 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2581 Constraint = (),
2582 >,
2583 for<'de> crate::wire::DeviceTransactRequest<'de>: ::fidl_next::Decode<
2584 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2585 Constraint = (),
2586 >,
2587{
2588 async fn on_one_way(
2589 handler: &mut ___H,
2590 mut message: ::fidl_next::Message<___T>,
2591 ) -> ::core::result::Result<
2592 (),
2593 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
2594 > {
2595 match *message.header().ordinal {
2596 ordinal => {
2597 handler.on_unknown_interaction(ordinal).await;
2598 if ::core::matches!(
2599 message.header().flexibility(),
2600 ::fidl_next::protocol::Flexibility::Strict
2601 ) {
2602 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2603 } else {
2604 Ok(())
2605 }
2606 }
2607 }
2608 }
2609
2610 async fn on_two_way(
2611 handler: &mut ___H,
2612 mut message: ::fidl_next::Message<___T>,
2613 responder: ::fidl_next::protocol::Responder<___T>,
2614 ) -> ::core::result::Result<
2615 (),
2616 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
2617 > {
2618 match *message.header().ordinal {
2619 5122675640437495577 => {
2620 let responder = ::fidl_next::Responder::from_untyped(responder);
2621
2622 handler.get_max_transfer_size(responder).await;
2623 Ok(())
2624 }
2625
2626 8193992212524563188 => {
2627 let responder = ::fidl_next::Responder::from_untyped(responder);
2628
2629 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2630 Ok(decoded) => {
2631 handler
2632 .set_bitrate(::fidl_next::Request::from_decoded(decoded), responder)
2633 .await;
2634 Ok(())
2635 }
2636 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2637 ordinal: 8193992212524563188,
2638 error,
2639 }),
2640 }
2641 }
2642
2643 6461839908402215334 => {
2644 let responder = ::fidl_next::Responder::from_untyped(responder);
2645
2646 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2647 Ok(decoded) => {
2648 handler
2649 .transact(::fidl_next::Request::from_decoded(decoded), responder)
2650 .await;
2651 Ok(())
2652 }
2653 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2654 ordinal: 6461839908402215334,
2655 error,
2656 }),
2657 }
2658 }
2659
2660 ordinal => {
2661 handler.on_unknown_interaction(ordinal).await;
2662 if ::core::matches!(
2663 message.header().flexibility(),
2664 ::fidl_next::protocol::Flexibility::Strict
2665 ) {
2666 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2667 } else {
2668 responder
2669 .respond_framework_error(
2670 ordinal,
2671 ::fidl_next::FrameworkError::UnknownMethod,
2672 )
2673 .expect("encoding a framework error should never fail")
2674 .await?;
2675 Ok(())
2676 }
2677 }
2678 }
2679 }
2680}
2681
2682pub trait DeviceClientHandler<
2686 #[cfg(feature = "driver")] ___T: ::fidl_next::Transport = ::fdf_fidl::DriverChannel,
2687 #[cfg(not(feature = "driver"))] ___T: ::fidl_next::Transport,
2688>
2689{
2690 fn on_unknown_interaction(
2691 &mut self,
2692 ordinal: u64,
2693 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
2694 ::core::future::ready(())
2695 }
2696}
2697
2698impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Device
2699where
2700 ___H: DeviceClientHandler<___T> + ::core::marker::Send,
2701 ___T: ::fidl_next::Transport,
2702{
2703 async fn on_event(
2704 handler: &mut ___H,
2705 mut message: ::fidl_next::Message<___T>,
2706 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
2707 match *message.header().ordinal {
2708 ordinal => {
2709 handler.on_unknown_interaction(ordinal).await;
2710 if ::core::matches!(
2711 message.header().flexibility(),
2712 ::fidl_next::protocol::Flexibility::Strict
2713 ) {
2714 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2715 } else {
2716 Ok(())
2717 }
2718 }
2719 }
2720 }
2721}
2722
2723pub trait DeviceServerHandler<
2727 #[cfg(feature = "driver")] ___T: ::fidl_next::Transport = ::fdf_fidl::DriverChannel,
2728 #[cfg(not(feature = "driver"))] ___T: ::fidl_next::Transport,
2729>
2730{
2731 fn get_max_transfer_size(
2732 &mut self,
2733
2734 responder: ::fidl_next::Responder<device::GetMaxTransferSize, ___T>,
2735 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2736
2737 #[doc = " Sets the bitrate for the i2c bus in KHz units.\n"]
2738 fn set_bitrate(
2739 &mut self,
2740
2741 request: ::fidl_next::Request<device::SetBitrate, ___T>,
2742
2743 responder: ::fidl_next::Responder<device::SetBitrate, ___T>,
2744 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2745
2746 #[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"]
2747 fn transact(
2748 &mut self,
2749
2750 request: ::fidl_next::Request<device::Transact, ___T>,
2751
2752 responder: ::fidl_next::Responder<device::Transact, ___T>,
2753 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2754
2755 fn on_unknown_interaction(
2756 &mut self,
2757 ordinal: u64,
2758 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
2759 ::core::future::ready(())
2760 }
2761}
2762
2763impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Device
2764where
2765 ___H: DeviceServerHandler<___T> + ::core::marker::Send,
2766 ___T: ::fidl_next::Transport,
2767 for<'de> crate::wire::DeviceSetBitrateRequest: ::fidl_next::Decode<
2768 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2769 Constraint = (),
2770 >,
2771 for<'de> crate::wire::DeviceTransactRequest<'de>: ::fidl_next::Decode<
2772 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2773 Constraint = (),
2774 >,
2775{
2776 async fn on_one_way(
2777 handler: &mut ___H,
2778 mut message: ::fidl_next::Message<___T>,
2779 ) -> ::core::result::Result<
2780 (),
2781 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
2782 > {
2783 match *message.header().ordinal {
2784 ordinal => {
2785 handler.on_unknown_interaction(ordinal).await;
2786 if ::core::matches!(
2787 message.header().flexibility(),
2788 ::fidl_next::protocol::Flexibility::Strict
2789 ) {
2790 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2791 } else {
2792 Ok(())
2793 }
2794 }
2795 }
2796 }
2797
2798 async fn on_two_way(
2799 handler: &mut ___H,
2800 mut message: ::fidl_next::Message<___T>,
2801 responder: ::fidl_next::protocol::Responder<___T>,
2802 ) -> ::core::result::Result<
2803 (),
2804 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
2805 > {
2806 match *message.header().ordinal {
2807 5122675640437495577 => {
2808 let responder = ::fidl_next::Responder::from_untyped(responder);
2809
2810 handler.get_max_transfer_size(responder).await;
2811 Ok(())
2812 }
2813
2814 8193992212524563188 => {
2815 let responder = ::fidl_next::Responder::from_untyped(responder);
2816
2817 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2818 Ok(decoded) => {
2819 handler
2820 .set_bitrate(::fidl_next::Request::from_decoded(decoded), responder)
2821 .await;
2822 Ok(())
2823 }
2824 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2825 ordinal: 8193992212524563188,
2826 error,
2827 }),
2828 }
2829 }
2830
2831 6461839908402215334 => {
2832 let responder = ::fidl_next::Responder::from_untyped(responder);
2833
2834 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2835 Ok(decoded) => {
2836 handler
2837 .transact(::fidl_next::Request::from_decoded(decoded), responder)
2838 .await;
2839 Ok(())
2840 }
2841 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2842 ordinal: 6461839908402215334,
2843 error,
2844 }),
2845 }
2846 }
2847
2848 ordinal => {
2849 handler.on_unknown_interaction(ordinal).await;
2850 if ::core::matches!(
2851 message.header().flexibility(),
2852 ::fidl_next::protocol::Flexibility::Strict
2853 ) {
2854 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2855 } else {
2856 responder
2857 .respond_framework_error(
2858 ordinal,
2859 ::fidl_next::FrameworkError::UnknownMethod,
2860 )
2861 .expect("encoding a framework error should never fail")
2862 .await?;
2863 Ok(())
2864 }
2865 }
2866 }
2867 }
2868}
2869
2870impl<___T> DeviceClientHandler<___T> for ::fidl_next::IgnoreEvents
2871where
2872 ___T: ::fidl_next::Transport,
2873{
2874 async fn on_unknown_interaction(&mut self, _: u64) {}
2875}
2876
2877impl<___H, ___T> DeviceLocalClientHandler<___T> for ::fidl_next::Local<___H>
2878where
2879 ___H: DeviceClientHandler<___T>,
2880 ___T: ::fidl_next::Transport,
2881{
2882 async fn on_unknown_interaction(&mut self, ordinal: u64) {
2883 ___H::on_unknown_interaction(&mut self.0, ordinal).await
2884 }
2885}
2886
2887impl<___H, ___T> DeviceLocalServerHandler<___T> for ::fidl_next::Local<___H>
2888where
2889 ___H: DeviceServerHandler<___T>,
2890 ___T: ::fidl_next::Transport,
2891{
2892 async fn get_max_transfer_size(
2893 &mut self,
2894
2895 responder: ::fidl_next::Responder<device::GetMaxTransferSize, ___T>,
2896 ) {
2897 ___H::get_max_transfer_size(&mut self.0, responder).await
2898 }
2899
2900 async fn set_bitrate(
2901 &mut self,
2902
2903 request: ::fidl_next::Request<device::SetBitrate, ___T>,
2904
2905 responder: ::fidl_next::Responder<device::SetBitrate, ___T>,
2906 ) {
2907 ___H::set_bitrate(&mut self.0, request, responder).await
2908 }
2909
2910 async fn transact(
2911 &mut self,
2912
2913 request: ::fidl_next::Request<device::Transact, ___T>,
2914
2915 responder: ::fidl_next::Responder<device::Transact, ___T>,
2916 ) {
2917 ___H::transact(&mut self.0, request, responder).await
2918 }
2919
2920 async fn on_unknown_interaction(&mut self, ordinal: u64) {
2921 ___H::on_unknown_interaction(&mut self.0, ordinal).await
2922 }
2923}