1#![warn(clippy::all)]
3#![allow(unused_parens, unused_variables, unused_mut, unused_imports, unreachable_code)]
4
5pub mod natural {
6
7 #[doc = " If `read_size` is set: This is a read transfer, and `read_size` bytes will be read from the\n target.\n If `write_data` is set: This is a write transfer, and `write_data` will be written to the\n target.\n"]
8 #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
9 pub enum DataTransfer {
10 ReadSize(u32),
11
12 WriteData(::std::vec::Vec<u8>),
13
14 UnknownOrdinal_(u64),
15 }
16
17 impl DataTransfer {
18 pub fn is_unknown(&self) -> bool {
19 #[allow(unreachable_patterns)]
20 match self {
21 Self::UnknownOrdinal_(_) => true,
22 _ => false,
23 }
24 }
25 }
26
27 unsafe impl<___E> ::fidl_next::Encode<crate::wire::DataTransfer<'static>, ___E> for DataTransfer
28 where
29 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
30 ___E: ::fidl_next::Encoder,
31 {
32 #[inline]
33 fn encode(
34 self,
35 encoder: &mut ___E,
36 out: &mut ::core::mem::MaybeUninit<crate::wire::DataTransfer<'static>>,
37 _: (),
38 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
39 ::fidl_next::munge!(let crate::wire::DataTransfer { raw, _phantom: _ } = out);
40
41 match self {
42 Self::ReadSize(value) => ::fidl_next::wire::Union::encode_as::<
43 ___E,
44 ::fidl_next::wire::Uint32,
45 >(value, 1, encoder, raw, ())?,
46
47 Self::WriteData(value) => ::fidl_next::wire::Union::encode_as::<
48 ___E,
49 ::fidl_next::wire::Vector<'static, u8>,
50 >(value, 2, encoder, raw, (32768, ()))?,
51
52 Self::UnknownOrdinal_(ordinal) => {
53 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize));
54 }
55 }
56
57 Ok(())
58 }
59 }
60
61 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DataTransfer<'static>, ___E>
62 for &'a DataTransfer
63 where
64 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
65 ___E: ::fidl_next::Encoder,
66 {
67 #[inline]
68 fn encode(
69 self,
70 encoder: &mut ___E,
71 out: &mut ::core::mem::MaybeUninit<crate::wire::DataTransfer<'static>>,
72 _: (),
73 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
74 ::fidl_next::munge!(let crate::wire::DataTransfer { raw, _phantom: _ } = out);
75
76 match self {
77 DataTransfer::ReadSize(value) => ::fidl_next::wire::Union::encode_as::<
78 ___E,
79 ::fidl_next::wire::Uint32,
80 >(value, 1, encoder, raw, ())?,
81
82 DataTransfer::WriteData(value) => {
83 ::fidl_next::wire::Union::encode_as::<
84 ___E,
85 ::fidl_next::wire::Vector<'static, u8>,
86 >(value, 2, encoder, raw, (32768, ()))?
87 }
88
89 DataTransfer::UnknownOrdinal_(ordinal) => {
90 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize));
91 }
92 }
93
94 Ok(())
95 }
96 }
97
98 unsafe impl<___E> ::fidl_next::EncodeOption<crate::wire_optional::DataTransfer<'static>, ___E>
99 for DataTransfer
100 where
101 ___E: ?Sized,
102 DataTransfer: ::fidl_next::Encode<crate::wire::DataTransfer<'static>, ___E>,
103 {
104 #[inline]
105 fn encode_option(
106 this: ::core::option::Option<Self>,
107 encoder: &mut ___E,
108 out: &mut ::core::mem::MaybeUninit<crate::wire_optional::DataTransfer<'static>>,
109 _: (),
110 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
111 ::fidl_next::munge!(let crate::wire_optional::DataTransfer { raw, _phantom: _ } = &mut *out);
112
113 if let Some(inner) = this {
114 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
115 ::fidl_next::Encode::encode(inner, encoder, value_out, ())?;
116 } else {
117 ::fidl_next::wire::Union::encode_absent(raw);
118 }
119
120 Ok(())
121 }
122 }
123
124 unsafe impl<'a, ___E>
125 ::fidl_next::EncodeOption<crate::wire_optional::DataTransfer<'static>, ___E>
126 for &'a DataTransfer
127 where
128 ___E: ?Sized,
129 &'a DataTransfer: ::fidl_next::Encode<crate::wire::DataTransfer<'static>, ___E>,
130 {
131 #[inline]
132 fn encode_option(
133 this: ::core::option::Option<Self>,
134 encoder: &mut ___E,
135 out: &mut ::core::mem::MaybeUninit<crate::wire_optional::DataTransfer<'static>>,
136 _: (),
137 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
138 ::fidl_next::munge!(let crate::wire_optional::DataTransfer { raw, _phantom: _ } = &mut *out);
139
140 if let Some(inner) = this {
141 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
142 ::fidl_next::Encode::encode(inner, encoder, value_out, ())?;
143 } else {
144 ::fidl_next::wire::Union::encode_absent(raw);
145 }
146
147 Ok(())
148 }
149 }
150
151 impl<'de> ::fidl_next::FromWire<crate::wire::DataTransfer<'de>> for DataTransfer {
152 #[inline]
153 fn from_wire(wire: crate::wire::DataTransfer<'de>) -> Self {
154 let wire = ::core::mem::ManuallyDrop::new(wire);
155 match wire.raw.ordinal() {
156 1 => Self::ReadSize(::fidl_next::FromWire::from_wire(unsafe {
157 wire.raw.get().read_unchecked::<::fidl_next::wire::Uint32>()
158 })),
159
160 2 => Self::WriteData(::fidl_next::FromWire::from_wire(unsafe {
161 wire.raw.get().read_unchecked::<::fidl_next::wire::Vector<'de, u8>>()
162 })),
163
164 ord => return Self::UnknownOrdinal_(ord as u64),
165 }
166 }
167 }
168
169 impl<'de> ::fidl_next::FromWireRef<crate::wire::DataTransfer<'de>> for DataTransfer {
170 #[inline]
171 fn from_wire_ref(wire: &crate::wire::DataTransfer<'de>) -> Self {
172 match wire.raw.ordinal() {
173 1 => Self::ReadSize(::fidl_next::FromWireRef::from_wire_ref(unsafe {
174 wire.raw.get().deref_unchecked::<::fidl_next::wire::Uint32>()
175 })),
176
177 2 => Self::WriteData(::fidl_next::FromWireRef::from_wire_ref(unsafe {
178 wire.raw.get().deref_unchecked::<::fidl_next::wire::Vector<'de, u8>>()
179 })),
180
181 ord => return Self::UnknownOrdinal_(ord as u64),
182 }
183 }
184 }
185
186 impl<'de> ::fidl_next::FromWireOption<crate::wire_optional::DataTransfer<'de>> for DataTransfer {
187 #[inline]
188 fn from_wire_option(
189 wire: crate::wire_optional::DataTransfer<'de>,
190 ) -> ::core::option::Option<Self> {
191 if let Some(inner) = wire.into_option() {
192 Some(::fidl_next::FromWire::from_wire(inner))
193 } else {
194 None
195 }
196 }
197 }
198
199 impl<'de> ::fidl_next::FromWireOption<crate::wire_optional::DataTransfer<'de>>
200 for Box<DataTransfer>
201 {
202 #[inline]
203 fn from_wire_option(
204 wire: crate::wire_optional::DataTransfer<'de>,
205 ) -> ::core::option::Option<Self> {
206 <
207 DataTransfer as ::fidl_next::FromWireOption<crate::wire_optional::DataTransfer<'de>>
208 >::from_wire_option(wire).map(Box::new)
209 }
210 }
211
212 impl<'de> ::fidl_next::FromWireOptionRef<crate::wire_optional::DataTransfer<'de>>
213 for Box<DataTransfer>
214 {
215 #[inline]
216 fn from_wire_option_ref(
217 wire: &crate::wire_optional::DataTransfer<'de>,
218 ) -> ::core::option::Option<Self> {
219 if let Some(inner) = wire.as_ref() {
220 Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner)))
221 } else {
222 None
223 }
224 }
225 }
226
227 #[doc = " `data_transfer` is mandatory, and specifies whether this transaction has a read or a write\n transfer (see above).\n `stop` is optional, and specifies whether this transaction is terminated by a stop condition (if\n true) or by a repeated-start (if false or unspecified). If this transaction is the last in the\n list then a stop condition is generated regardless of the value of `stop`.\n"]
228 #[derive(Debug, Default, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
229 pub struct Transaction {
230 pub data_transfer: ::core::option::Option<crate::natural::DataTransfer>,
231
232 pub stop: ::core::option::Option<bool>,
233 }
234
235 impl Transaction {
236 fn __max_ordinal(&self) -> usize {
237 if self.stop.is_some() {
238 return 2;
239 }
240
241 if self.data_transfer.is_some() {
242 return 1;
243 }
244
245 0
246 }
247 }
248
249 unsafe impl<___E> ::fidl_next::Encode<crate::wire::Transaction<'static>, ___E> for Transaction
250 where
251 ___E: ::fidl_next::Encoder + ?Sized,
252 {
253 #[inline]
254 fn encode(
255 mut self,
256 encoder: &mut ___E,
257 out: &mut ::core::mem::MaybeUninit<crate::wire::Transaction<'static>>,
258 _: (),
259 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
260 ::fidl_next::munge!(let crate::wire::Transaction { table } = out);
261
262 let max_ord = self.__max_ordinal();
263
264 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
265 ::fidl_next::Wire::zero_padding(&mut out);
266
267 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
268 ::fidl_next::wire::Envelope,
269 >(encoder, max_ord);
270
271 for i in 1..=max_ord {
272 match i {
273 2 => {
274 if let Some(value) = self.stop.take() {
275 ::fidl_next::wire::Envelope::encode_value::<bool, ___E>(
276 value,
277 preallocated.encoder,
278 &mut out,
279 (),
280 )?;
281 } else {
282 ::fidl_next::wire::Envelope::encode_zero(&mut out)
283 }
284 }
285
286 1 => {
287 if let Some(value) = self.data_transfer.take() {
288 ::fidl_next::wire::Envelope::encode_value::<
289 crate::wire::DataTransfer<'static>,
290 ___E,
291 >(
292 value, preallocated.encoder, &mut out, ()
293 )?;
294 } else {
295 ::fidl_next::wire::Envelope::encode_zero(&mut out)
296 }
297 }
298
299 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
300 }
301 unsafe {
302 preallocated.write_next(out.assume_init_ref());
303 }
304 }
305
306 ::fidl_next::wire::Table::encode_len(table, max_ord);
307
308 Ok(())
309 }
310 }
311
312 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::Transaction<'static>, ___E>
313 for &'a Transaction
314 where
315 ___E: ::fidl_next::Encoder + ?Sized,
316 {
317 #[inline]
318 fn encode(
319 self,
320 encoder: &mut ___E,
321 out: &mut ::core::mem::MaybeUninit<crate::wire::Transaction<'static>>,
322 _: (),
323 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
324 ::fidl_next::munge!(let crate::wire::Transaction { table } = out);
325
326 let max_ord = self.__max_ordinal();
327
328 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
329 ::fidl_next::Wire::zero_padding(&mut out);
330
331 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
332 ::fidl_next::wire::Envelope,
333 >(encoder, max_ord);
334
335 for i in 1..=max_ord {
336 match i {
337 2 => {
338 if let Some(value) = &self.stop {
339 ::fidl_next::wire::Envelope::encode_value::<bool, ___E>(
340 value,
341 preallocated.encoder,
342 &mut out,
343 (),
344 )?;
345 } else {
346 ::fidl_next::wire::Envelope::encode_zero(&mut out)
347 }
348 }
349
350 1 => {
351 if let Some(value) = &self.data_transfer {
352 ::fidl_next::wire::Envelope::encode_value::<
353 crate::wire::DataTransfer<'static>,
354 ___E,
355 >(
356 value, preallocated.encoder, &mut out, ()
357 )?;
358 } else {
359 ::fidl_next::wire::Envelope::encode_zero(&mut out)
360 }
361 }
362
363 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
364 }
365 unsafe {
366 preallocated.write_next(out.assume_init_ref());
367 }
368 }
369
370 ::fidl_next::wire::Table::encode_len(table, max_ord);
371
372 Ok(())
373 }
374 }
375
376 impl<'de> ::fidl_next::FromWire<crate::wire::Transaction<'de>> for Transaction {
377 #[inline]
378 fn from_wire(wire_: crate::wire::Transaction<'de>) -> Self {
379 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
380
381 let data_transfer = wire_.table.get(1);
382
383 let stop = wire_.table.get(2);
384
385 Self {
386 data_transfer: data_transfer.map(|envelope| {
387 ::fidl_next::FromWire::from_wire(unsafe {
388 envelope.read_unchecked::<crate::wire::DataTransfer<'de>>()
389 })
390 }),
391
392 stop: stop.map(|envelope| {
393 ::fidl_next::FromWire::from_wire(unsafe { envelope.read_unchecked::<bool>() })
394 }),
395 }
396 }
397 }
398
399 impl<'de> ::fidl_next::FromWireRef<crate::wire::Transaction<'de>> for Transaction {
400 #[inline]
401 fn from_wire_ref(wire: &crate::wire::Transaction<'de>) -> Self {
402 Self {
403 data_transfer: wire.table.get(1).map(|envelope| {
404 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
405 envelope.deref_unchecked::<crate::wire::DataTransfer<'de>>()
406 })
407 }),
408
409 stop: wire.table.get(2).map(|envelope| {
410 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
411 envelope.deref_unchecked::<bool>()
412 })
413 }),
414 }
415 }
416 }
417
418 #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
419 pub struct DeviceTransferRequest {
420 pub transactions: ::std::vec::Vec<crate::natural::Transaction>,
421 }
422
423 unsafe impl<___E> ::fidl_next::Encode<crate::wire::DeviceTransferRequest<'static>, ___E>
424 for DeviceTransferRequest
425 where
426 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
427 ___E: ::fidl_next::Encoder,
428 {
429 #[inline]
430 fn encode(
431 self,
432 encoder_: &mut ___E,
433 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceTransferRequest<'static>>,
434 _: (),
435 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
436 ::fidl_next::munge! {
437 let crate::wire::DeviceTransferRequest {
438 transactions,
439
440 } = out_;
441 }
442
443 ::fidl_next::Encode::encode(self.transactions, encoder_, transactions, (256, ()))?;
444
445 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(transactions.as_mut_ptr()) };
446 ::fidl_next::Constrained::validate(_field, (256, ()))?;
447
448 Ok(())
449 }
450 }
451
452 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DeviceTransferRequest<'static>, ___E>
453 for &'a DeviceTransferRequest
454 where
455 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
456 ___E: ::fidl_next::Encoder,
457 {
458 #[inline]
459 fn encode(
460 self,
461 encoder_: &mut ___E,
462 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceTransferRequest<'static>>,
463 _: (),
464 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
465 ::fidl_next::munge! {
466 let crate::wire::DeviceTransferRequest {
467 transactions,
468
469 } = out_;
470 }
471
472 ::fidl_next::Encode::encode(&self.transactions, encoder_, transactions, (256, ()))?;
473
474 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(transactions.as_mut_ptr()) };
475 ::fidl_next::Constrained::validate(_field, (256, ()))?;
476
477 Ok(())
478 }
479 }
480
481 unsafe impl<___E>
482 ::fidl_next::EncodeOption<
483 ::fidl_next::wire::Box<'static, crate::wire::DeviceTransferRequest<'static>>,
484 ___E,
485 > for DeviceTransferRequest
486 where
487 ___E: ::fidl_next::Encoder + ?Sized,
488 DeviceTransferRequest:
489 ::fidl_next::Encode<crate::wire::DeviceTransferRequest<'static>, ___E>,
490 {
491 #[inline]
492 fn encode_option(
493 this: ::core::option::Option<Self>,
494 encoder: &mut ___E,
495 out: &mut ::core::mem::MaybeUninit<
496 ::fidl_next::wire::Box<'static, crate::wire::DeviceTransferRequest<'static>>,
497 >,
498 _: (),
499 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
500 if let Some(inner) = this {
501 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
502 ::fidl_next::wire::Box::encode_present(out);
503 } else {
504 ::fidl_next::wire::Box::encode_absent(out);
505 }
506
507 Ok(())
508 }
509 }
510
511 unsafe impl<'a, ___E>
512 ::fidl_next::EncodeOption<
513 ::fidl_next::wire::Box<'static, crate::wire::DeviceTransferRequest<'static>>,
514 ___E,
515 > for &'a DeviceTransferRequest
516 where
517 ___E: ::fidl_next::Encoder + ?Sized,
518 &'a DeviceTransferRequest:
519 ::fidl_next::Encode<crate::wire::DeviceTransferRequest<'static>, ___E>,
520 {
521 #[inline]
522 fn encode_option(
523 this: ::core::option::Option<Self>,
524 encoder: &mut ___E,
525 out: &mut ::core::mem::MaybeUninit<
526 ::fidl_next::wire::Box<'static, crate::wire::DeviceTransferRequest<'static>>,
527 >,
528 _: (),
529 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
530 if let Some(inner) = this {
531 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
532 ::fidl_next::wire::Box::encode_present(out);
533 } else {
534 ::fidl_next::wire::Box::encode_absent(out);
535 }
536
537 Ok(())
538 }
539 }
540
541 impl<'de> ::fidl_next::FromWire<crate::wire::DeviceTransferRequest<'de>> for DeviceTransferRequest {
542 #[inline]
543 fn from_wire(wire: crate::wire::DeviceTransferRequest<'de>) -> Self {
544 Self { transactions: ::fidl_next::FromWire::from_wire(wire.transactions) }
545 }
546 }
547
548 impl<'de> ::fidl_next::FromWireRef<crate::wire::DeviceTransferRequest<'de>>
549 for DeviceTransferRequest
550 {
551 #[inline]
552 fn from_wire_ref(wire: &crate::wire::DeviceTransferRequest<'de>) -> Self {
553 Self { transactions: ::fidl_next::FromWireRef::from_wire_ref(&wire.transactions) }
554 }
555 }
556
557 #[doc = " Used to return data from read transfers.\n"]
558 pub type ReadData = ::std::vec::Vec<u8>;
559
560 #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
561 pub struct DeviceTransferResponse {
562 pub read_data: ::std::vec::Vec<::std::vec::Vec<u8>>,
563 }
564
565 unsafe impl<___E> ::fidl_next::Encode<crate::wire::DeviceTransferResponse<'static>, ___E>
566 for DeviceTransferResponse
567 where
568 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
569 ___E: ::fidl_next::Encoder,
570 {
571 #[inline]
572 fn encode(
573 self,
574 encoder_: &mut ___E,
575 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceTransferResponse<'static>>,
576 _: (),
577 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
578 ::fidl_next::munge! {
579 let crate::wire::DeviceTransferResponse {
580 read_data,
581
582 } = out_;
583 }
584
585 ::fidl_next::Encode::encode(self.read_data, encoder_, read_data, (256, (32768, ())))?;
586
587 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(read_data.as_mut_ptr()) };
588 ::fidl_next::Constrained::validate(_field, (256, (32768, ())))?;
589
590 Ok(())
591 }
592 }
593
594 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DeviceTransferResponse<'static>, ___E>
595 for &'a DeviceTransferResponse
596 where
597 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
598 ___E: ::fidl_next::Encoder,
599 {
600 #[inline]
601 fn encode(
602 self,
603 encoder_: &mut ___E,
604 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceTransferResponse<'static>>,
605 _: (),
606 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
607 ::fidl_next::munge! {
608 let crate::wire::DeviceTransferResponse {
609 read_data,
610
611 } = out_;
612 }
613
614 ::fidl_next::Encode::encode(&self.read_data, encoder_, read_data, (256, (32768, ())))?;
615
616 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(read_data.as_mut_ptr()) };
617 ::fidl_next::Constrained::validate(_field, (256, (32768, ())))?;
618
619 Ok(())
620 }
621 }
622
623 unsafe impl<___E>
624 ::fidl_next::EncodeOption<
625 ::fidl_next::wire::Box<'static, crate::wire::DeviceTransferResponse<'static>>,
626 ___E,
627 > for DeviceTransferResponse
628 where
629 ___E: ::fidl_next::Encoder + ?Sized,
630 DeviceTransferResponse:
631 ::fidl_next::Encode<crate::wire::DeviceTransferResponse<'static>, ___E>,
632 {
633 #[inline]
634 fn encode_option(
635 this: ::core::option::Option<Self>,
636 encoder: &mut ___E,
637 out: &mut ::core::mem::MaybeUninit<
638 ::fidl_next::wire::Box<'static, crate::wire::DeviceTransferResponse<'static>>,
639 >,
640 _: (),
641 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
642 if let Some(inner) = this {
643 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
644 ::fidl_next::wire::Box::encode_present(out);
645 } else {
646 ::fidl_next::wire::Box::encode_absent(out);
647 }
648
649 Ok(())
650 }
651 }
652
653 unsafe impl<'a, ___E>
654 ::fidl_next::EncodeOption<
655 ::fidl_next::wire::Box<'static, crate::wire::DeviceTransferResponse<'static>>,
656 ___E,
657 > for &'a DeviceTransferResponse
658 where
659 ___E: ::fidl_next::Encoder + ?Sized,
660 &'a DeviceTransferResponse:
661 ::fidl_next::Encode<crate::wire::DeviceTransferResponse<'static>, ___E>,
662 {
663 #[inline]
664 fn encode_option(
665 this: ::core::option::Option<Self>,
666 encoder: &mut ___E,
667 out: &mut ::core::mem::MaybeUninit<
668 ::fidl_next::wire::Box<'static, crate::wire::DeviceTransferResponse<'static>>,
669 >,
670 _: (),
671 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
672 if let Some(inner) = this {
673 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
674 ::fidl_next::wire::Box::encode_present(out);
675 } else {
676 ::fidl_next::wire::Box::encode_absent(out);
677 }
678
679 Ok(())
680 }
681 }
682
683 impl<'de> ::fidl_next::FromWire<crate::wire::DeviceTransferResponse<'de>>
684 for DeviceTransferResponse
685 {
686 #[inline]
687 fn from_wire(wire: crate::wire::DeviceTransferResponse<'de>) -> Self {
688 Self { read_data: ::fidl_next::FromWire::from_wire(wire.read_data) }
689 }
690 }
691
692 impl<'de> ::fidl_next::FromWireRef<crate::wire::DeviceTransferResponse<'de>>
693 for DeviceTransferResponse
694 {
695 #[inline]
696 fn from_wire_ref(wire: &crate::wire::DeviceTransferResponse<'de>) -> Self {
697 Self { read_data: ::fidl_next::FromWireRef::from_wire_ref(&wire.read_data) }
698 }
699 }
700
701 #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
702 pub struct DeviceGetNameResponse {
703 pub name: ::std::string::String,
704 }
705
706 unsafe impl<___E> ::fidl_next::Encode<crate::wire::DeviceGetNameResponse<'static>, ___E>
707 for DeviceGetNameResponse
708 where
709 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
710 ___E: ::fidl_next::Encoder,
711 {
712 #[inline]
713 fn encode(
714 self,
715 encoder_: &mut ___E,
716 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetNameResponse<'static>>,
717 _: (),
718 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
719 ::fidl_next::munge! {
720 let crate::wire::DeviceGetNameResponse {
721 name,
722
723 } = out_;
724 }
725
726 ::fidl_next::Encode::encode(self.name, encoder_, name, 64)?;
727
728 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(name.as_mut_ptr()) };
729 ::fidl_next::Constrained::validate(_field, 64)?;
730
731 Ok(())
732 }
733 }
734
735 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DeviceGetNameResponse<'static>, ___E>
736 for &'a DeviceGetNameResponse
737 where
738 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
739 ___E: ::fidl_next::Encoder,
740 {
741 #[inline]
742 fn encode(
743 self,
744 encoder_: &mut ___E,
745 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetNameResponse<'static>>,
746 _: (),
747 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
748 ::fidl_next::munge! {
749 let crate::wire::DeviceGetNameResponse {
750 name,
751
752 } = out_;
753 }
754
755 ::fidl_next::Encode::encode(&self.name, encoder_, name, 64)?;
756
757 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(name.as_mut_ptr()) };
758 ::fidl_next::Constrained::validate(_field, 64)?;
759
760 Ok(())
761 }
762 }
763
764 unsafe impl<___E>
765 ::fidl_next::EncodeOption<
766 ::fidl_next::wire::Box<'static, crate::wire::DeviceGetNameResponse<'static>>,
767 ___E,
768 > for DeviceGetNameResponse
769 where
770 ___E: ::fidl_next::Encoder + ?Sized,
771 DeviceGetNameResponse:
772 ::fidl_next::Encode<crate::wire::DeviceGetNameResponse<'static>, ___E>,
773 {
774 #[inline]
775 fn encode_option(
776 this: ::core::option::Option<Self>,
777 encoder: &mut ___E,
778 out: &mut ::core::mem::MaybeUninit<
779 ::fidl_next::wire::Box<'static, crate::wire::DeviceGetNameResponse<'static>>,
780 >,
781 _: (),
782 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
783 if let Some(inner) = this {
784 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
785 ::fidl_next::wire::Box::encode_present(out);
786 } else {
787 ::fidl_next::wire::Box::encode_absent(out);
788 }
789
790 Ok(())
791 }
792 }
793
794 unsafe impl<'a, ___E>
795 ::fidl_next::EncodeOption<
796 ::fidl_next::wire::Box<'static, crate::wire::DeviceGetNameResponse<'static>>,
797 ___E,
798 > for &'a DeviceGetNameResponse
799 where
800 ___E: ::fidl_next::Encoder + ?Sized,
801 &'a DeviceGetNameResponse:
802 ::fidl_next::Encode<crate::wire::DeviceGetNameResponse<'static>, ___E>,
803 {
804 #[inline]
805 fn encode_option(
806 this: ::core::option::Option<Self>,
807 encoder: &mut ___E,
808 out: &mut ::core::mem::MaybeUninit<
809 ::fidl_next::wire::Box<'static, crate::wire::DeviceGetNameResponse<'static>>,
810 >,
811 _: (),
812 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
813 if let Some(inner) = this {
814 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
815 ::fidl_next::wire::Box::encode_present(out);
816 } else {
817 ::fidl_next::wire::Box::encode_absent(out);
818 }
819
820 Ok(())
821 }
822 }
823
824 impl<'de> ::fidl_next::FromWire<crate::wire::DeviceGetNameResponse<'de>> for DeviceGetNameResponse {
825 #[inline]
826 fn from_wire(wire: crate::wire::DeviceGetNameResponse<'de>) -> Self {
827 Self { name: ::fidl_next::FromWire::from_wire(wire.name) }
828 }
829 }
830
831 impl<'de> ::fidl_next::FromWireRef<crate::wire::DeviceGetNameResponse<'de>>
832 for DeviceGetNameResponse
833 {
834 #[inline]
835 fn from_wire_ref(wire: &crate::wire::DeviceGetNameResponse<'de>) -> Self {
836 Self { name: ::fidl_next::FromWireRef::from_wire_ref(&wire.name) }
837 }
838 }
839}
840
841pub mod wire {
842
843 #[repr(transparent)]
845 pub struct DataTransfer<'de> {
846 pub(crate) raw: ::fidl_next::wire::Union,
847 pub(crate) _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
848 }
849
850 impl<'de> Drop for DataTransfer<'de> {
851 fn drop(&mut self) {
852 match self.raw.ordinal() {
853 1 => {
854 let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::wire::Uint32>() };
855 }
856
857 2 => {
858 let _ = unsafe {
859 self.raw.get().read_unchecked::<::fidl_next::wire::Vector<'de, u8>>()
860 };
861 }
862
863 _ => (),
864 }
865 }
866 }
867
868 impl ::fidl_next::Constrained for DataTransfer<'_> {
869 type Constraint = ();
870
871 fn validate(
872 _: ::fidl_next::Slot<'_, Self>,
873 _: Self::Constraint,
874 ) -> Result<(), ::fidl_next::ValidationError> {
875 Ok(())
876 }
877 }
878
879 unsafe impl ::fidl_next::Wire for DataTransfer<'static> {
880 type Narrowed<'de> = DataTransfer<'de>;
881
882 #[inline]
883 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
884 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
885 ::fidl_next::wire::Union::zero_padding(raw);
886 }
887 }
888
889 pub mod data_transfer {
890 pub enum Ref<'de> {
891 ReadSize(&'de ::fidl_next::wire::Uint32),
892
893 WriteData(&'de ::fidl_next::wire::Vector<'de, u8>),
894
895 UnknownOrdinal_(u64),
896 }
897
898 pub enum Value<'de> {
899 ReadSize(::fidl_next::wire::Uint32),
900
901 WriteData(::fidl_next::wire::Vector<'de, u8>),
902
903 UnknownOrdinal_(u64),
904 }
905 }
906
907 impl<'de> DataTransfer<'de> {
908 pub fn as_ref(&self) -> crate::wire::data_transfer::Ref<'_> {
909 match self.raw.ordinal() {
910 1 => crate::wire::data_transfer::Ref::ReadSize(unsafe {
911 self.raw.get().deref_unchecked::<::fidl_next::wire::Uint32>()
912 }),
913
914 2 => crate::wire::data_transfer::Ref::WriteData(unsafe {
915 self.raw.get().deref_unchecked::<::fidl_next::wire::Vector<'_, u8>>()
916 }),
917
918 unknown => crate::wire::data_transfer::Ref::UnknownOrdinal_(unknown),
919 }
920 }
921
922 pub fn into_inner(self) -> crate::wire::data_transfer::Value<'de> {
923 let this = ::core::mem::ManuallyDrop::new(self);
924
925 match this.raw.ordinal() {
926 1 => crate::wire::data_transfer::Value::ReadSize(unsafe {
927 this.raw.get().read_unchecked::<::fidl_next::wire::Uint32>()
928 }),
929
930 2 => crate::wire::data_transfer::Value::WriteData(unsafe {
931 this.raw.get().read_unchecked::<::fidl_next::wire::Vector<'de, u8>>()
932 }),
933
934 unknown => crate::wire::data_transfer::Value::UnknownOrdinal_(unknown),
935 }
936 }
937 }
938
939 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for DataTransfer<'de>
940 where
941 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
942 ___D: ::fidl_next::Decoder<'de>,
943 {
944 fn decode(
945 mut slot: ::fidl_next::Slot<'_, Self>,
946 decoder: &mut ___D,
947 _: (),
948 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
949 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
950 match ::fidl_next::wire::Union::encoded_ordinal(raw.as_mut()) {
951 1 => ::fidl_next::wire::Union::decode_as::<___D, ::fidl_next::wire::Uint32>(
952 raw,
953 decoder,
954 (),
955 )?,
956
957 2 => {
958 ::fidl_next::wire::Union::decode_as::<___D, ::fidl_next::wire::Vector<'de, u8>>(
959 raw,
960 decoder,
961 (32768, ()),
962 )?
963 }
964
965 _ => ::fidl_next::wire::Union::decode_unknown(raw, decoder)?,
966 }
967
968 Ok(())
969 }
970 }
971
972 impl<'de> ::core::fmt::Debug for DataTransfer<'de> {
973 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
974 match self.raw.ordinal() {
975 1 => unsafe {
976 self.raw.get().deref_unchecked::<::fidl_next::wire::Uint32>().fmt(f)
977 },
978 2 => unsafe {
979 self.raw.get().deref_unchecked::<::fidl_next::wire::Vector<'_, u8>>().fmt(f)
980 },
981 _ => unsafe { ::core::hint::unreachable_unchecked() },
982 }
983 }
984 }
985
986 impl<'de> ::fidl_next::IntoNatural for DataTransfer<'de> {
987 type Natural = crate::natural::DataTransfer;
988 }
989
990 #[repr(C)]
992 pub struct Transaction<'de> {
993 pub(crate) table: ::fidl_next::wire::Table<'de>,
994 }
995
996 impl<'de> Drop for Transaction<'de> {
997 fn drop(&mut self) {
998 let _ = self.table.get(1).map(|envelope| unsafe {
999 envelope.read_unchecked::<crate::wire::DataTransfer<'de>>()
1000 });
1001
1002 let _ = self.table.get(2).map(|envelope| unsafe { envelope.read_unchecked::<bool>() });
1003 }
1004 }
1005
1006 impl ::fidl_next::Constrained for Transaction<'_> {
1007 type Constraint = ();
1008
1009 fn validate(
1010 _: ::fidl_next::Slot<'_, Self>,
1011 _: Self::Constraint,
1012 ) -> Result<(), ::fidl_next::ValidationError> {
1013 Ok(())
1014 }
1015 }
1016
1017 unsafe impl ::fidl_next::Wire for Transaction<'static> {
1018 type Narrowed<'de> = Transaction<'de>;
1019
1020 #[inline]
1021 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
1022 ::fidl_next::munge!(let Self { table } = out);
1023 ::fidl_next::wire::Table::zero_padding(table);
1024 }
1025 }
1026
1027 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for Transaction<'de>
1028 where
1029 ___D: ::fidl_next::Decoder<'de> + ?Sized,
1030 {
1031 fn decode(
1032 slot: ::fidl_next::Slot<'_, Self>,
1033 decoder: &mut ___D,
1034 _: (),
1035 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1036 ::fidl_next::munge!(let Self { table } = slot);
1037
1038 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
1039 match ordinal {
1040 0 => unsafe { ::core::hint::unreachable_unchecked() },
1041
1042 1 => {
1043 ::fidl_next::wire::Envelope::decode_as::<
1044 ___D,
1045 crate::wire::DataTransfer<'de>,
1046 >(slot.as_mut(), decoder, ())?;
1047
1048 Ok(())
1049 }
1050
1051 2 => {
1052 ::fidl_next::wire::Envelope::decode_as::<___D, bool>(
1053 slot.as_mut(),
1054 decoder,
1055 (),
1056 )?;
1057
1058 Ok(())
1059 }
1060
1061 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
1062 }
1063 })
1064 }
1065 }
1066
1067 impl<'de> Transaction<'de> {
1068 pub fn data_transfer(&self) -> ::core::option::Option<&crate::wire::DataTransfer<'de>> {
1069 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
1070 }
1071
1072 pub fn take_data_transfer(
1073 &mut self,
1074 ) -> ::core::option::Option<crate::wire::DataTransfer<'de>> {
1075 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
1076 }
1077
1078 pub fn stop(&self) -> ::core::option::Option<&bool> {
1079 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
1080 }
1081
1082 pub fn take_stop(&mut self) -> ::core::option::Option<bool> {
1083 unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
1084 }
1085 }
1086
1087 impl<'de> ::core::fmt::Debug for Transaction<'de> {
1088 fn fmt(
1089 &self,
1090 f: &mut ::core::fmt::Formatter<'_>,
1091 ) -> ::core::result::Result<(), ::core::fmt::Error> {
1092 f.debug_struct("Transaction")
1093 .field("data_transfer", &self.data_transfer())
1094 .field("stop", &self.stop())
1095 .finish()
1096 }
1097 }
1098
1099 impl<'de> ::fidl_next::IntoNatural for Transaction<'de> {
1100 type Natural = crate::natural::Transaction;
1101 }
1102
1103 #[derive(Debug)]
1105 #[repr(C)]
1106 pub struct DeviceTransferRequest<'de> {
1107 pub transactions: ::fidl_next::wire::Vector<'de, crate::wire::Transaction<'de>>,
1108 }
1109
1110 static_assertions::const_assert_eq!(std::mem::size_of::<DeviceTransferRequest<'_>>(), 16);
1111 static_assertions::const_assert_eq!(std::mem::align_of::<DeviceTransferRequest<'_>>(), 8);
1112
1113 static_assertions::const_assert_eq!(
1114 std::mem::offset_of!(DeviceTransferRequest<'_>, transactions),
1115 0
1116 );
1117
1118 impl ::fidl_next::Constrained for DeviceTransferRequest<'_> {
1119 type Constraint = ();
1120
1121 fn validate(
1122 _: ::fidl_next::Slot<'_, Self>,
1123 _: Self::Constraint,
1124 ) -> Result<(), ::fidl_next::ValidationError> {
1125 Ok(())
1126 }
1127 }
1128
1129 unsafe impl ::fidl_next::Wire for DeviceTransferRequest<'static> {
1130 type Narrowed<'de> = DeviceTransferRequest<'de>;
1131
1132 #[inline]
1133 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1134 ::fidl_next::munge! {
1135 let Self {
1136 transactions,
1137
1138 } = &mut *out_;
1139 }
1140
1141 ::fidl_next::Wire::zero_padding(transactions);
1142 }
1143 }
1144
1145 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for DeviceTransferRequest<'de>
1146 where
1147 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1148 ___D: ::fidl_next::Decoder<'de>,
1149 {
1150 fn decode(
1151 slot_: ::fidl_next::Slot<'_, Self>,
1152 decoder_: &mut ___D,
1153 _: (),
1154 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1155 ::fidl_next::munge! {
1156 let Self {
1157 mut transactions,
1158
1159 } = slot_;
1160 }
1161
1162 let _field = transactions.as_mut();
1163 ::fidl_next::Constrained::validate(_field, (256, ()))?;
1164 ::fidl_next::Decode::decode(transactions.as_mut(), decoder_, (256, ()))?;
1165
1166 let transactions = unsafe { transactions.deref_unchecked() };
1167
1168 if transactions.len() > 256 {
1169 return Err(::fidl_next::DecodeError::VectorTooLong {
1170 size: transactions.len() as u64,
1171 limit: 256,
1172 });
1173 }
1174
1175 Ok(())
1176 }
1177 }
1178
1179 impl<'de> ::fidl_next::IntoNatural for DeviceTransferRequest<'de> {
1180 type Natural = crate::natural::DeviceTransferRequest;
1181 }
1182
1183 pub type ReadData<'de> = ::fidl_next::wire::Vector<'de, u8>;
1185
1186 #[derive(Debug)]
1188 #[repr(C)]
1189 pub struct DeviceTransferResponse<'de> {
1190 pub read_data: ::fidl_next::wire::Vector<'de, ::fidl_next::wire::Vector<'de, u8>>,
1191 }
1192
1193 static_assertions::const_assert_eq!(std::mem::size_of::<DeviceTransferResponse<'_>>(), 16);
1194 static_assertions::const_assert_eq!(std::mem::align_of::<DeviceTransferResponse<'_>>(), 8);
1195
1196 static_assertions::const_assert_eq!(
1197 std::mem::offset_of!(DeviceTransferResponse<'_>, read_data),
1198 0
1199 );
1200
1201 impl ::fidl_next::Constrained for DeviceTransferResponse<'_> {
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 DeviceTransferResponse<'static> {
1213 type Narrowed<'de> = DeviceTransferResponse<'de>;
1214
1215 #[inline]
1216 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1217 ::fidl_next::munge! {
1218 let Self {
1219 read_data,
1220
1221 } = &mut *out_;
1222 }
1223
1224 ::fidl_next::Wire::zero_padding(read_data);
1225 }
1226 }
1227
1228 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for DeviceTransferResponse<'de>
1229 where
1230 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1231 ___D: ::fidl_next::Decoder<'de>,
1232 {
1233 fn decode(
1234 slot_: ::fidl_next::Slot<'_, Self>,
1235 decoder_: &mut ___D,
1236 _: (),
1237 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1238 ::fidl_next::munge! {
1239 let Self {
1240 mut read_data,
1241
1242 } = slot_;
1243 }
1244
1245 let _field = read_data.as_mut();
1246 ::fidl_next::Constrained::validate(_field, (256, (32768, ())))?;
1247 ::fidl_next::Decode::decode(read_data.as_mut(), decoder_, (256, (32768, ())))?;
1248
1249 let read_data = unsafe { read_data.deref_unchecked() };
1250
1251 if read_data.len() > 256 {
1252 return Err(::fidl_next::DecodeError::VectorTooLong {
1253 size: read_data.len() as u64,
1254 limit: 256,
1255 });
1256 }
1257
1258 Ok(())
1259 }
1260 }
1261
1262 impl<'de> ::fidl_next::IntoNatural for DeviceTransferResponse<'de> {
1263 type Natural = crate::natural::DeviceTransferResponse;
1264 }
1265
1266 #[derive(Debug)]
1268 #[repr(C)]
1269 pub struct DeviceGetNameResponse<'de> {
1270 pub name: ::fidl_next::wire::String<'de>,
1271 }
1272
1273 static_assertions::const_assert_eq!(std::mem::size_of::<DeviceGetNameResponse<'_>>(), 16);
1274 static_assertions::const_assert_eq!(std::mem::align_of::<DeviceGetNameResponse<'_>>(), 8);
1275
1276 static_assertions::const_assert_eq!(std::mem::offset_of!(DeviceGetNameResponse<'_>, name), 0);
1277
1278 impl ::fidl_next::Constrained for DeviceGetNameResponse<'_> {
1279 type Constraint = ();
1280
1281 fn validate(
1282 _: ::fidl_next::Slot<'_, Self>,
1283 _: Self::Constraint,
1284 ) -> Result<(), ::fidl_next::ValidationError> {
1285 Ok(())
1286 }
1287 }
1288
1289 unsafe impl ::fidl_next::Wire for DeviceGetNameResponse<'static> {
1290 type Narrowed<'de> = DeviceGetNameResponse<'de>;
1291
1292 #[inline]
1293 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1294 ::fidl_next::munge! {
1295 let Self {
1296 name,
1297
1298 } = &mut *out_;
1299 }
1300
1301 ::fidl_next::Wire::zero_padding(name);
1302 }
1303 }
1304
1305 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for DeviceGetNameResponse<'de>
1306 where
1307 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1308 ___D: ::fidl_next::Decoder<'de>,
1309 {
1310 fn decode(
1311 slot_: ::fidl_next::Slot<'_, Self>,
1312 decoder_: &mut ___D,
1313 _: (),
1314 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1315 ::fidl_next::munge! {
1316 let Self {
1317 mut name,
1318
1319 } = slot_;
1320 }
1321
1322 let _field = name.as_mut();
1323 ::fidl_next::Constrained::validate(_field, 64)?;
1324 ::fidl_next::Decode::decode(name.as_mut(), decoder_, 64)?;
1325
1326 let name = unsafe { name.deref_unchecked() };
1327
1328 if name.len() > 64 {
1329 return Err(::fidl_next::DecodeError::VectorTooLong {
1330 size: name.len() as u64,
1331 limit: 64,
1332 });
1333 }
1334
1335 Ok(())
1336 }
1337 }
1338
1339 impl<'de> ::fidl_next::IntoNatural for DeviceGetNameResponse<'de> {
1340 type Natural = crate::natural::DeviceGetNameResponse;
1341 }
1342}
1343
1344pub mod wire_optional {
1345
1346 #[repr(transparent)]
1347 pub struct DataTransfer<'de> {
1348 pub(crate) raw: ::fidl_next::wire::Union,
1349 pub(crate) _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
1350 }
1351
1352 impl ::fidl_next::Constrained for DataTransfer<'_> {
1353 type Constraint = ();
1354
1355 fn validate(
1356 _: ::fidl_next::Slot<'_, Self>,
1357 _: Self::Constraint,
1358 ) -> Result<(), ::fidl_next::ValidationError> {
1359 Ok(())
1360 }
1361 }
1362
1363 unsafe impl ::fidl_next::Wire for DataTransfer<'static> {
1364 type Narrowed<'de> = DataTransfer<'de>;
1365
1366 #[inline]
1367 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
1368 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
1369 ::fidl_next::wire::Union::zero_padding(raw);
1370 }
1371 }
1372
1373 impl<'de> DataTransfer<'de> {
1374 pub fn is_some(&self) -> bool {
1375 self.raw.is_some()
1376 }
1377
1378 pub fn is_none(&self) -> bool {
1379 self.raw.is_none()
1380 }
1381
1382 pub fn as_ref(&self) -> ::core::option::Option<&crate::wire::DataTransfer<'de>> {
1383 if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None }
1384 }
1385
1386 pub fn into_option(self) -> ::core::option::Option<crate::wire::DataTransfer<'de>> {
1387 if self.is_some() {
1388 Some(crate::wire::DataTransfer {
1389 raw: self.raw,
1390 _phantom: ::core::marker::PhantomData,
1391 })
1392 } else {
1393 None
1394 }
1395 }
1396 }
1397
1398 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for DataTransfer<'de>
1399 where
1400 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1401 ___D: ::fidl_next::Decoder<'de>,
1402 {
1403 fn decode(
1404 mut slot: ::fidl_next::Slot<'_, Self>,
1405 decoder: &mut ___D,
1406 _: (),
1407 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1408 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
1409 match ::fidl_next::wire::Union::encoded_ordinal(raw.as_mut()) {
1410 1 => ::fidl_next::wire::Union::decode_as::<___D, ::fidl_next::wire::Uint32>(
1411 raw,
1412 decoder,
1413 (),
1414 )?,
1415
1416 2 => {
1417 ::fidl_next::wire::Union::decode_as::<___D, ::fidl_next::wire::Vector<'de, u8>>(
1418 raw,
1419 decoder,
1420 (32768, ()),
1421 )?
1422 }
1423
1424 0 => ::fidl_next::wire::Union::decode_absent(raw)?,
1425 _ => ::fidl_next::wire::Union::decode_unknown(raw, decoder)?,
1426 }
1427
1428 Ok(())
1429 }
1430 }
1431
1432 impl<'de> ::core::fmt::Debug for DataTransfer<'de> {
1433 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1434 self.as_ref().fmt(f)
1435 }
1436 }
1437
1438 impl<'de> ::fidl_next::IntoNatural for DataTransfer<'de> {
1439 type Natural = ::core::option::Option<crate::natural::DataTransfer>;
1440 }
1441}
1442
1443pub mod generic {
1444
1445 pub struct DeviceTransferRequest<T0> {
1447 pub transactions: T0,
1448 }
1449
1450 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceTransferRequest<'static>, ___E>
1451 for DeviceTransferRequest<T0>
1452 where
1453 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1454 ___E: ::fidl_next::Encoder,
1455 T0: ::fidl_next::Encode<
1456 ::fidl_next::wire::Vector<'static, crate::wire::Transaction<'static>>,
1457 ___E,
1458 >,
1459 {
1460 #[inline]
1461 fn encode(
1462 self,
1463 encoder_: &mut ___E,
1464 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceTransferRequest<'static>>,
1465 _: (),
1466 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1467 ::fidl_next::munge! {
1468 let crate::wire::DeviceTransferRequest {
1469 transactions,
1470
1471 } = out_;
1472 }
1473
1474 ::fidl_next::Encode::encode(self.transactions, encoder_, transactions, (256, ()))?;
1475
1476 Ok(())
1477 }
1478 }
1479
1480 pub struct DeviceTransferResponse<T0> {
1482 pub read_data: T0,
1483 }
1484
1485 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceTransferResponse<'static>, ___E>
1486 for DeviceTransferResponse<T0>
1487 where
1488 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1489 ___E: ::fidl_next::Encoder,
1490 T0: ::fidl_next::Encode<
1491 ::fidl_next::wire::Vector<'static, ::fidl_next::wire::Vector<'static, u8>>,
1492 ___E,
1493 >,
1494 {
1495 #[inline]
1496 fn encode(
1497 self,
1498 encoder_: &mut ___E,
1499 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceTransferResponse<'static>>,
1500 _: (),
1501 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1502 ::fidl_next::munge! {
1503 let crate::wire::DeviceTransferResponse {
1504 read_data,
1505
1506 } = out_;
1507 }
1508
1509 ::fidl_next::Encode::encode(self.read_data, encoder_, read_data, (256, (32768, ())))?;
1510
1511 Ok(())
1512 }
1513 }
1514
1515 pub struct DeviceGetNameResponse<T0> {
1517 pub name: T0,
1518 }
1519
1520 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceGetNameResponse<'static>, ___E>
1521 for DeviceGetNameResponse<T0>
1522 where
1523 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1524 ___E: ::fidl_next::Encoder,
1525 T0: ::fidl_next::Encode<::fidl_next::wire::String<'static>, ___E>,
1526 {
1527 #[inline]
1528 fn encode(
1529 self,
1530 encoder_: &mut ___E,
1531 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetNameResponse<'static>>,
1532 _: (),
1533 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1534 ::fidl_next::munge! {
1535 let crate::wire::DeviceGetNameResponse {
1536 name,
1537
1538 } = out_;
1539 }
1540
1541 ::fidl_next::Encode::encode(self.name, encoder_, name, 64)?;
1542
1543 Ok(())
1544 }
1545 }
1546}
1547
1548pub use self::natural::*;
1549
1550#[doc = " Clients should be aware of the max channel message size when using large transfers or many\n transactions. It is possible to generate a message that uses values less than the limits below\n but is still too big for the channel.\n\n The maximum number of bytes that can be read or written in a single `Transaction`.\n"]
1551pub const MAX_TRANSFER_SIZE: u32 = 32768 as u32;
1552
1553#[doc = " The maximum number of transactions that can be specified in a call to `Transfer`.\n"]
1554pub const MAX_COUNT_TRANSACTIONS: u32 = 256 as u32;
1555
1556#[doc = " Maximum length of the I2C Channel name.\n"]
1557pub const MAX_I2_C_NAME_LEN: u32 = 64 as u32;
1558
1559#[derive(PartialEq, Debug)]
1561pub struct Device;
1562
1563impl ::fidl_next::Discoverable for Device {
1564 const PROTOCOL_NAME: &'static str = "fuchsia.hardware.i2c.Device";
1565}
1566
1567#[cfg(target_os = "fuchsia")]
1568impl ::fidl_next::HasTransport for Device {
1569 type Transport = ::fidl_next::fuchsia::zx::Channel;
1570}
1571
1572pub mod device {
1573 pub mod prelude {
1574 pub use crate::{
1575 Device, DeviceClientHandler, DeviceLocalClientHandler, DeviceLocalServerHandler,
1576 DeviceServerHandler, device,
1577 };
1578
1579 pub use crate::natural::DeviceTransferRequest;
1580
1581 pub use crate::natural::DeviceGetNameResponse;
1582
1583 pub use crate::natural::DeviceTransferResponse;
1584 }
1585
1586 pub struct Transfer;
1587
1588 impl ::fidl_next::Method for Transfer {
1589 const ORDINAL: u64 = 871058866166117179;
1590 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1591 ::fidl_next::protocol::Flexibility::Strict;
1592
1593 type Protocol = crate::Device;
1594
1595 type Request = crate::wire::DeviceTransferRequest<'static>;
1596 }
1597
1598 impl ::fidl_next::TwoWayMethod for Transfer {
1599 type Response = ::fidl_next::wire::Result<
1600 'static,
1601 crate::wire::DeviceTransferResponse<'static>,
1602 ::fidl_next::wire::fuchsia::Status,
1603 >;
1604 }
1605
1606 impl<___R> ::fidl_next::Respond<___R> for Transfer {
1607 type Output = ::core::result::Result<
1608 crate::generic::DeviceTransferResponse<___R>,
1609 ::fidl_next::never::Never,
1610 >;
1611
1612 fn respond(response: ___R) -> Self::Output {
1613 ::core::result::Result::Ok(crate::generic::DeviceTransferResponse {
1614 read_data: response,
1615 })
1616 }
1617 }
1618
1619 impl<___R> ::fidl_next::RespondErr<___R> for Transfer {
1620 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
1621
1622 fn respond_err(response: ___R) -> Self::Output {
1623 ::core::result::Result::Err(response)
1624 }
1625 }
1626
1627 pub struct GetName;
1628
1629 impl ::fidl_next::Method for GetName {
1630 const ORDINAL: u64 = 8381876914474840322;
1631 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1632 ::fidl_next::protocol::Flexibility::Strict;
1633
1634 type Protocol = crate::Device;
1635
1636 type Request = ::fidl_next::wire::EmptyMessageBody;
1637 }
1638
1639 impl ::fidl_next::TwoWayMethod for GetName {
1640 type Response = ::fidl_next::wire::Result<
1641 'static,
1642 crate::wire::DeviceGetNameResponse<'static>,
1643 ::fidl_next::wire::fuchsia::Status,
1644 >;
1645 }
1646
1647 impl<___R> ::fidl_next::Respond<___R> for GetName {
1648 type Output = ::core::result::Result<
1649 crate::generic::DeviceGetNameResponse<___R>,
1650 ::fidl_next::never::Never,
1651 >;
1652
1653 fn respond(response: ___R) -> Self::Output {
1654 ::core::result::Result::Ok(crate::generic::DeviceGetNameResponse { name: response })
1655 }
1656 }
1657
1658 impl<___R> ::fidl_next::RespondErr<___R> for GetName {
1659 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
1660
1661 fn respond_err(response: ___R) -> Self::Output {
1662 ::core::result::Result::Err(response)
1663 }
1664 }
1665
1666 mod ___detail {
1667 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Device
1668 where
1669 ___T: ::fidl_next::Transport,
1670 {
1671 type Client = DeviceClient<___T>;
1672 type Server = DeviceServer<___T>;
1673 }
1674
1675 #[repr(transparent)]
1677 pub struct DeviceClient<___T: ::fidl_next::Transport> {
1678 #[allow(dead_code)]
1679 client: ::fidl_next::protocol::Client<___T>,
1680 }
1681
1682 impl<___T> DeviceClient<___T>
1683 where
1684 ___T: ::fidl_next::Transport,
1685 {
1686 #[doc = " Issue one or more transactions to a particular I2C device.\n\n Each `Transaction` is performed in the order in which it appears in `transactions`. Data for\n read transfers (if there are any) is returned through `read_data`, which has one entry for\n each read transfer in `transactions`. Transaction processing continues until all transfers\n have been completed, an error occurs, or the target issues a NACK in response to a write\n transfer.\n\n The possible error values are:\n ZX_ERR_INVALID_ARGS: `transactions` has zero elements, `data_transfer` was not specified\n for a `Transaction`, or there was a zero-length `DataTransfer`.\n ZX_ERR_OUT_OF_RANGE: A `DataTransfer` was too large to be handled by this I2C controller.\n ZX_ERR_IO_NOT_PRESENT: The device did not respond to its I2C address.\n ZX_ERR_IO_REFUSED: The device issued a NACK before the end of a write transfer.\n"]
1687 pub fn transfer(
1688 &self,
1689
1690 transactions: impl ::fidl_next::Encode<
1691 ::fidl_next::wire::Vector<'static, crate::wire::Transaction<'static>>,
1692 <___T as ::fidl_next::Transport>::SendBuffer,
1693 >,
1694 ) -> ::fidl_next::TwoWayFuture<'_, super::Transfer, ___T>
1695 where
1696 <___T as ::fidl_next::Transport>::SendBuffer:
1697 ::fidl_next::encoder::InternalHandleEncoder,
1698 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
1699 {
1700 self.transfer_with(crate::generic::DeviceTransferRequest { transactions })
1701 }
1702
1703 #[doc = " Issue one or more transactions to a particular I2C device.\n\n Each `Transaction` is performed in the order in which it appears in `transactions`. Data for\n read transfers (if there are any) is returned through `read_data`, which has one entry for\n each read transfer in `transactions`. Transaction processing continues until all transfers\n have been completed, an error occurs, or the target issues a NACK in response to a write\n transfer.\n\n The possible error values are:\n ZX_ERR_INVALID_ARGS: `transactions` has zero elements, `data_transfer` was not specified\n for a `Transaction`, or there was a zero-length `DataTransfer`.\n ZX_ERR_OUT_OF_RANGE: A `DataTransfer` was too large to be handled by this I2C controller.\n ZX_ERR_IO_NOT_PRESENT: The device did not respond to its I2C address.\n ZX_ERR_IO_REFUSED: The device issued a NACK before the end of a write transfer.\n"]
1704 pub fn transfer_with<___R>(
1705 &self,
1706 request: ___R,
1707 ) -> ::fidl_next::TwoWayFuture<'_, super::Transfer, ___T>
1708 where
1709 ___R: ::fidl_next::Encode<
1710 crate::wire::DeviceTransferRequest<'static>,
1711 <___T as ::fidl_next::Transport>::SendBuffer,
1712 >,
1713 {
1714 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1715 871058866166117179,
1716 <super::Transfer as ::fidl_next::Method>::FLEXIBILITY,
1717 request,
1718 ))
1719 }
1720
1721 #[doc = " Get the name of this I2C Device. Returns ZX_ERR_NOT_SUPPORTED if the\n name is unspecified or the empty string.\n"]
1722 pub fn get_name(&self) -> ::fidl_next::TwoWayFuture<'_, super::GetName, ___T> {
1723 ::fidl_next::TwoWayFuture::from_untyped(
1724 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
1725 8381876914474840322,
1726 <super::GetName as ::fidl_next::Method>::FLEXIBILITY,
1727 (),
1728 ),
1729 )
1730 }
1731 }
1732
1733 #[repr(transparent)]
1735 pub struct DeviceServer<___T: ::fidl_next::Transport> {
1736 server: ::fidl_next::protocol::Server<___T>,
1737 }
1738
1739 impl<___T> DeviceServer<___T> where ___T: ::fidl_next::Transport {}
1740 }
1741}
1742
1743#[diagnostic::on_unimplemented(
1744 note = "If {Self} implements the non-local DeviceClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
1745)]
1746
1747pub trait DeviceLocalClientHandler<
1751 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1752 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1753>
1754{
1755}
1756
1757impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Device
1758where
1759 ___H: DeviceLocalClientHandler<___T>,
1760 ___T: ::fidl_next::Transport,
1761{
1762 async fn on_event(
1763 handler: &mut ___H,
1764 mut message: ::fidl_next::Message<___T>,
1765 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1766 match *message.header().ordinal {
1767 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
1768 }
1769 }
1770}
1771
1772#[diagnostic::on_unimplemented(
1773 note = "If {Self} implements the non-local DeviceServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
1774)]
1775
1776pub trait DeviceLocalServerHandler<
1780 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1781 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1782>
1783{
1784 #[doc = " Issue one or more transactions to a particular I2C device.\n\n Each `Transaction` is performed in the order in which it appears in `transactions`. Data for\n read transfers (if there are any) is returned through `read_data`, which has one entry for\n each read transfer in `transactions`. Transaction processing continues until all transfers\n have been completed, an error occurs, or the target issues a NACK in response to a write\n transfer.\n\n The possible error values are:\n ZX_ERR_INVALID_ARGS: `transactions` has zero elements, `data_transfer` was not specified\n for a `Transaction`, or there was a zero-length `DataTransfer`.\n ZX_ERR_OUT_OF_RANGE: A `DataTransfer` was too large to be handled by this I2C controller.\n ZX_ERR_IO_NOT_PRESENT: The device did not respond to its I2C address.\n ZX_ERR_IO_REFUSED: The device issued a NACK before the end of a write transfer.\n"]
1785 fn transfer(
1786 &mut self,
1787
1788 request: ::fidl_next::Request<device::Transfer, ___T>,
1789
1790 responder: ::fidl_next::Responder<device::Transfer, ___T>,
1791 ) -> impl ::core::future::Future<Output = ()>;
1792
1793 #[doc = " Get the name of this I2C Device. Returns ZX_ERR_NOT_SUPPORTED if the\n name is unspecified or the empty string.\n"]
1794 fn get_name(
1795 &mut self,
1796
1797 responder: ::fidl_next::Responder<device::GetName, ___T>,
1798 ) -> impl ::core::future::Future<Output = ()>;
1799}
1800
1801impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Device
1802where
1803 ___H: DeviceLocalServerHandler<___T>,
1804 ___T: ::fidl_next::Transport,
1805 for<'de> crate::wire::DeviceTransferRequest<'de>: ::fidl_next::Decode<
1806 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1807 Constraint = (),
1808 >,
1809{
1810 async fn on_one_way(
1811 handler: &mut ___H,
1812 mut message: ::fidl_next::Message<___T>,
1813 ) -> ::core::result::Result<
1814 (),
1815 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1816 > {
1817 match *message.header().ordinal {
1818 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
1819 }
1820 }
1821
1822 async fn on_two_way(
1823 handler: &mut ___H,
1824 mut message: ::fidl_next::Message<___T>,
1825 responder: ::fidl_next::protocol::Responder<___T>,
1826 ) -> ::core::result::Result<
1827 (),
1828 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1829 > {
1830 match *message.header().ordinal {
1831 871058866166117179 => {
1832 let responder = ::fidl_next::Responder::from_untyped(responder);
1833
1834 match ::fidl_next::AsDecoderExt::into_decoded(message) {
1835 Ok(decoded) => {
1836 handler
1837 .transfer(::fidl_next::Request::from_decoded(decoded), responder)
1838 .await;
1839 Ok(())
1840 }
1841 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1842 ordinal: 871058866166117179,
1843 error,
1844 }),
1845 }
1846 }
1847
1848 8381876914474840322 => {
1849 let responder = ::fidl_next::Responder::from_untyped(responder);
1850
1851 handler.get_name(responder).await;
1852 Ok(())
1853 }
1854
1855 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
1856 }
1857 }
1858}
1859
1860pub trait DeviceClientHandler<
1864 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1865 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1866>
1867{
1868}
1869
1870impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Device
1871where
1872 ___H: DeviceClientHandler<___T> + ::core::marker::Send,
1873 ___T: ::fidl_next::Transport,
1874{
1875 async fn on_event(
1876 handler: &mut ___H,
1877 mut message: ::fidl_next::Message<___T>,
1878 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1879 match *message.header().ordinal {
1880 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
1881 }
1882 }
1883}
1884
1885pub trait DeviceServerHandler<
1889 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1890 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1891>
1892{
1893 #[doc = " Issue one or more transactions to a particular I2C device.\n\n Each `Transaction` is performed in the order in which it appears in `transactions`. Data for\n read transfers (if there are any) is returned through `read_data`, which has one entry for\n each read transfer in `transactions`. Transaction processing continues until all transfers\n have been completed, an error occurs, or the target issues a NACK in response to a write\n transfer.\n\n The possible error values are:\n ZX_ERR_INVALID_ARGS: `transactions` has zero elements, `data_transfer` was not specified\n for a `Transaction`, or there was a zero-length `DataTransfer`.\n ZX_ERR_OUT_OF_RANGE: A `DataTransfer` was too large to be handled by this I2C controller.\n ZX_ERR_IO_NOT_PRESENT: The device did not respond to its I2C address.\n ZX_ERR_IO_REFUSED: The device issued a NACK before the end of a write transfer.\n"]
1894 fn transfer(
1895 &mut self,
1896
1897 request: ::fidl_next::Request<device::Transfer, ___T>,
1898
1899 responder: ::fidl_next::Responder<device::Transfer, ___T>,
1900 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1901
1902 #[doc = " Get the name of this I2C Device. Returns ZX_ERR_NOT_SUPPORTED if the\n name is unspecified or the empty string.\n"]
1903 fn get_name(
1904 &mut self,
1905
1906 responder: ::fidl_next::Responder<device::GetName, ___T>,
1907 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1908}
1909
1910impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Device
1911where
1912 ___H: DeviceServerHandler<___T> + ::core::marker::Send,
1913 ___T: ::fidl_next::Transport,
1914 for<'de> crate::wire::DeviceTransferRequest<'de>: ::fidl_next::Decode<
1915 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1916 Constraint = (),
1917 >,
1918{
1919 async fn on_one_way(
1920 handler: &mut ___H,
1921 mut message: ::fidl_next::Message<___T>,
1922 ) -> ::core::result::Result<
1923 (),
1924 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1925 > {
1926 match *message.header().ordinal {
1927 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
1928 }
1929 }
1930
1931 async fn on_two_way(
1932 handler: &mut ___H,
1933 mut message: ::fidl_next::Message<___T>,
1934 responder: ::fidl_next::protocol::Responder<___T>,
1935 ) -> ::core::result::Result<
1936 (),
1937 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1938 > {
1939 match *message.header().ordinal {
1940 871058866166117179 => {
1941 let responder = ::fidl_next::Responder::from_untyped(responder);
1942
1943 match ::fidl_next::AsDecoderExt::into_decoded(message) {
1944 Ok(decoded) => {
1945 handler
1946 .transfer(::fidl_next::Request::from_decoded(decoded), responder)
1947 .await;
1948 Ok(())
1949 }
1950 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1951 ordinal: 871058866166117179,
1952 error,
1953 }),
1954 }
1955 }
1956
1957 8381876914474840322 => {
1958 let responder = ::fidl_next::Responder::from_untyped(responder);
1959
1960 handler.get_name(responder).await;
1961 Ok(())
1962 }
1963
1964 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
1965 }
1966 }
1967}
1968
1969impl<___T> DeviceClientHandler<___T> for ::fidl_next::IgnoreEvents where ___T: ::fidl_next::Transport
1970{}
1971
1972impl<___H, ___T> DeviceLocalClientHandler<___T> for ::fidl_next::Local<___H>
1973where
1974 ___H: DeviceClientHandler<___T>,
1975 ___T: ::fidl_next::Transport,
1976{
1977}
1978
1979impl<___H, ___T> DeviceLocalServerHandler<___T> for ::fidl_next::Local<___H>
1980where
1981 ___H: DeviceServerHandler<___T>,
1982 ___T: ::fidl_next::Transport,
1983{
1984 async fn transfer(
1985 &mut self,
1986
1987 request: ::fidl_next::Request<device::Transfer, ___T>,
1988
1989 responder: ::fidl_next::Responder<device::Transfer, ___T>,
1990 ) {
1991 ___H::transfer(&mut self.0, request, responder).await
1992 }
1993
1994 async fn get_name(&mut self, responder: ::fidl_next::Responder<device::GetName, ___T>) {
1995 ___H::get_name(&mut self.0, responder).await
1996 }
1997}