1#![warn(clippy::all)]
3#![allow(unused_parens, unused_variables, unused_mut, unused_imports, unreachable_code)]
4
5pub mod natural {
6
7 #[doc = " Number of bits per character\n"]
8 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
9 #[repr(u8)]
10 pub enum CharacterWidth {
11 Bits5 = 1,
12 Bits6 = 2,
13 Bits7 = 3,
14 Bits8 = 4,
15 }
16 impl ::core::convert::TryFrom<u8> for CharacterWidth {
17 type Error = ::fidl_next::UnknownStrictEnumMemberError;
18 fn try_from(
19 value: u8,
20 ) -> ::core::result::Result<Self, ::fidl_next::UnknownStrictEnumMemberError> {
21 match value {
22 1 => Ok(Self::Bits5),
23 2 => Ok(Self::Bits6),
24 3 => Ok(Self::Bits7),
25 4 => Ok(Self::Bits8),
26
27 _ => Err(::fidl_next::UnknownStrictEnumMemberError::new(value.into())),
28 }
29 }
30 }
31
32 impl ::std::convert::From<CharacterWidth> for u8 {
33 fn from(value: CharacterWidth) -> Self {
34 match value {
35 CharacterWidth::Bits5 => 1,
36 CharacterWidth::Bits6 => 2,
37 CharacterWidth::Bits7 => 3,
38 CharacterWidth::Bits8 => 4,
39 }
40 }
41 }
42
43 unsafe impl<___E> ::fidl_next::Encode<crate::wire::CharacterWidth, ___E> for CharacterWidth
44 where
45 ___E: ?Sized,
46 {
47 #[inline]
48 fn encode(
49 self,
50 encoder: &mut ___E,
51 out: &mut ::core::mem::MaybeUninit<crate::wire::CharacterWidth>,
52 _: (),
53 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
54 ::fidl_next::Encode::encode(&self, encoder, out, ())
55 }
56 }
57
58 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::CharacterWidth, ___E> for &'a CharacterWidth
59 where
60 ___E: ?Sized,
61 {
62 #[inline]
63 fn encode(
64 self,
65 encoder: &mut ___E,
66 out: &mut ::core::mem::MaybeUninit<crate::wire::CharacterWidth>,
67 _: (),
68 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
69 ::fidl_next::munge!(let crate::wire::CharacterWidth { value } = out);
70 let _ = value.write(u8::from(match *self {
71 CharacterWidth::Bits5 => 1,
72
73 CharacterWidth::Bits6 => 2,
74
75 CharacterWidth::Bits7 => 3,
76
77 CharacterWidth::Bits8 => 4,
78 }));
79
80 Ok(())
81 }
82 }
83
84 impl ::core::convert::From<crate::wire::CharacterWidth> for CharacterWidth {
85 fn from(wire: crate::wire::CharacterWidth) -> Self {
86 match u8::from(wire.value) {
87 1 => Self::Bits5,
88
89 2 => Self::Bits6,
90
91 3 => Self::Bits7,
92
93 4 => Self::Bits8,
94
95 _ => unsafe { ::core::hint::unreachable_unchecked() },
96 }
97 }
98 }
99
100 impl ::fidl_next::FromWire<crate::wire::CharacterWidth> for CharacterWidth {
101 #[inline]
102 fn from_wire(wire: crate::wire::CharacterWidth) -> Self {
103 Self::from(wire)
104 }
105 }
106
107 impl ::fidl_next::FromWireRef<crate::wire::CharacterWidth> for CharacterWidth {
108 #[inline]
109 fn from_wire_ref(wire: &crate::wire::CharacterWidth) -> Self {
110 Self::from(*wire)
111 }
112 }
113
114 #[doc = " Description of what type of serial device this is\n TODO(https://fxbug.dev/393643944): Consider replacing this enum.\n"]
115 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
116 #[repr(u8)]
117 pub enum Class {
118 Generic = 1,
119 BluetoothHci = 2,
120 Console = 3,
121 KernelDebug = 4,
122 Mcu = 5,
123 }
124 impl ::core::convert::TryFrom<u8> for Class {
125 type Error = ::fidl_next::UnknownStrictEnumMemberError;
126 fn try_from(
127 value: u8,
128 ) -> ::core::result::Result<Self, ::fidl_next::UnknownStrictEnumMemberError> {
129 match value {
130 1 => Ok(Self::Generic),
131 2 => Ok(Self::BluetoothHci),
132 3 => Ok(Self::Console),
133 4 => Ok(Self::KernelDebug),
134 5 => Ok(Self::Mcu),
135
136 _ => Err(::fidl_next::UnknownStrictEnumMemberError::new(value.into())),
137 }
138 }
139 }
140
141 impl ::std::convert::From<Class> for u8 {
142 fn from(value: Class) -> Self {
143 match value {
144 Class::Generic => 1,
145 Class::BluetoothHci => 2,
146 Class::Console => 3,
147 Class::KernelDebug => 4,
148 Class::Mcu => 5,
149 }
150 }
151 }
152
153 unsafe impl<___E> ::fidl_next::Encode<crate::wire::Class, ___E> for Class
154 where
155 ___E: ?Sized,
156 {
157 #[inline]
158 fn encode(
159 self,
160 encoder: &mut ___E,
161 out: &mut ::core::mem::MaybeUninit<crate::wire::Class>,
162 _: (),
163 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
164 ::fidl_next::Encode::encode(&self, encoder, out, ())
165 }
166 }
167
168 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::Class, ___E> for &'a Class
169 where
170 ___E: ?Sized,
171 {
172 #[inline]
173 fn encode(
174 self,
175 encoder: &mut ___E,
176 out: &mut ::core::mem::MaybeUninit<crate::wire::Class>,
177 _: (),
178 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
179 ::fidl_next::munge!(let crate::wire::Class { value } = out);
180 let _ = value.write(u8::from(match *self {
181 Class::Generic => 1,
182
183 Class::BluetoothHci => 2,
184
185 Class::Console => 3,
186
187 Class::KernelDebug => 4,
188
189 Class::Mcu => 5,
190 }));
191
192 Ok(())
193 }
194 }
195
196 impl ::core::convert::From<crate::wire::Class> for Class {
197 fn from(wire: crate::wire::Class) -> Self {
198 match u8::from(wire.value) {
199 1 => Self::Generic,
200
201 2 => Self::BluetoothHci,
202
203 3 => Self::Console,
204
205 4 => Self::KernelDebug,
206
207 5 => Self::Mcu,
208
209 _ => unsafe { ::core::hint::unreachable_unchecked() },
210 }
211 }
212 }
213
214 impl ::fidl_next::FromWire<crate::wire::Class> for Class {
215 #[inline]
216 fn from_wire(wire: crate::wire::Class) -> Self {
217 Self::from(wire)
218 }
219 }
220
221 impl ::fidl_next::FromWireRef<crate::wire::Class> for Class {
222 #[inline]
223 fn from_wire_ref(wire: &crate::wire::Class) -> Self {
224 Self::from(*wire)
225 }
226 }
227
228 #[doc = " Number of stop bits\n"]
229 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
230 #[repr(u8)]
231 pub enum StopWidth {
232 Bits1 = 1,
233 Bits2 = 2,
234 }
235 impl ::core::convert::TryFrom<u8> for StopWidth {
236 type Error = ::fidl_next::UnknownStrictEnumMemberError;
237 fn try_from(
238 value: u8,
239 ) -> ::core::result::Result<Self, ::fidl_next::UnknownStrictEnumMemberError> {
240 match value {
241 1 => Ok(Self::Bits1),
242 2 => Ok(Self::Bits2),
243
244 _ => Err(::fidl_next::UnknownStrictEnumMemberError::new(value.into())),
245 }
246 }
247 }
248
249 impl ::std::convert::From<StopWidth> for u8 {
250 fn from(value: StopWidth) -> Self {
251 match value {
252 StopWidth::Bits1 => 1,
253 StopWidth::Bits2 => 2,
254 }
255 }
256 }
257
258 unsafe impl<___E> ::fidl_next::Encode<crate::wire::StopWidth, ___E> for StopWidth
259 where
260 ___E: ?Sized,
261 {
262 #[inline]
263 fn encode(
264 self,
265 encoder: &mut ___E,
266 out: &mut ::core::mem::MaybeUninit<crate::wire::StopWidth>,
267 _: (),
268 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
269 ::fidl_next::Encode::encode(&self, encoder, out, ())
270 }
271 }
272
273 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::StopWidth, ___E> for &'a StopWidth
274 where
275 ___E: ?Sized,
276 {
277 #[inline]
278 fn encode(
279 self,
280 encoder: &mut ___E,
281 out: &mut ::core::mem::MaybeUninit<crate::wire::StopWidth>,
282 _: (),
283 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
284 ::fidl_next::munge!(let crate::wire::StopWidth { value } = out);
285 let _ = value.write(u8::from(match *self {
286 StopWidth::Bits1 => 1,
287
288 StopWidth::Bits2 => 2,
289 }));
290
291 Ok(())
292 }
293 }
294
295 impl ::core::convert::From<crate::wire::StopWidth> for StopWidth {
296 fn from(wire: crate::wire::StopWidth) -> Self {
297 match u8::from(wire.value) {
298 1 => Self::Bits1,
299
300 2 => Self::Bits2,
301
302 _ => unsafe { ::core::hint::unreachable_unchecked() },
303 }
304 }
305 }
306
307 impl ::fidl_next::FromWire<crate::wire::StopWidth> for StopWidth {
308 #[inline]
309 fn from_wire(wire: crate::wire::StopWidth) -> Self {
310 Self::from(wire)
311 }
312 }
313
314 impl ::fidl_next::FromWireRef<crate::wire::StopWidth> for StopWidth {
315 #[inline]
316 fn from_wire_ref(wire: &crate::wire::StopWidth) -> Self {
317 Self::from(*wire)
318 }
319 }
320
321 #[doc = " Which parity computation to use, if any.\n"]
322 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
323 #[repr(u8)]
324 pub enum Parity {
325 None = 1,
326 Even = 2,
327 Odd = 3,
328 }
329 impl ::core::convert::TryFrom<u8> for Parity {
330 type Error = ::fidl_next::UnknownStrictEnumMemberError;
331 fn try_from(
332 value: u8,
333 ) -> ::core::result::Result<Self, ::fidl_next::UnknownStrictEnumMemberError> {
334 match value {
335 1 => Ok(Self::None),
336 2 => Ok(Self::Even),
337 3 => Ok(Self::Odd),
338
339 _ => Err(::fidl_next::UnknownStrictEnumMemberError::new(value.into())),
340 }
341 }
342 }
343
344 impl ::std::convert::From<Parity> for u8 {
345 fn from(value: Parity) -> Self {
346 match value {
347 Parity::None => 1,
348 Parity::Even => 2,
349 Parity::Odd => 3,
350 }
351 }
352 }
353
354 unsafe impl<___E> ::fidl_next::Encode<crate::wire::Parity, ___E> for Parity
355 where
356 ___E: ?Sized,
357 {
358 #[inline]
359 fn encode(
360 self,
361 encoder: &mut ___E,
362 out: &mut ::core::mem::MaybeUninit<crate::wire::Parity>,
363 _: (),
364 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
365 ::fidl_next::Encode::encode(&self, encoder, out, ())
366 }
367 }
368
369 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::Parity, ___E> for &'a Parity
370 where
371 ___E: ?Sized,
372 {
373 #[inline]
374 fn encode(
375 self,
376 encoder: &mut ___E,
377 out: &mut ::core::mem::MaybeUninit<crate::wire::Parity>,
378 _: (),
379 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
380 ::fidl_next::munge!(let crate::wire::Parity { value } = out);
381 let _ = value.write(u8::from(match *self {
382 Parity::None => 1,
383
384 Parity::Even => 2,
385
386 Parity::Odd => 3,
387 }));
388
389 Ok(())
390 }
391 }
392
393 impl ::core::convert::From<crate::wire::Parity> for Parity {
394 fn from(wire: crate::wire::Parity) -> Self {
395 match u8::from(wire.value) {
396 1 => Self::None,
397
398 2 => Self::Even,
399
400 3 => Self::Odd,
401
402 _ => unsafe { ::core::hint::unreachable_unchecked() },
403 }
404 }
405 }
406
407 impl ::fidl_next::FromWire<crate::wire::Parity> for Parity {
408 #[inline]
409 fn from_wire(wire: crate::wire::Parity) -> Self {
410 Self::from(wire)
411 }
412 }
413
414 impl ::fidl_next::FromWireRef<crate::wire::Parity> for Parity {
415 #[inline]
416 fn from_wire_ref(wire: &crate::wire::Parity) -> Self {
417 Self::from(*wire)
418 }
419 }
420
421 #[doc = " What flow control mechanism to use\n"]
422 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
423 #[repr(u8)]
424 pub enum FlowControl {
425 None = 1,
426 CtsRts = 2,
427 }
428 impl ::core::convert::TryFrom<u8> for FlowControl {
429 type Error = ::fidl_next::UnknownStrictEnumMemberError;
430 fn try_from(
431 value: u8,
432 ) -> ::core::result::Result<Self, ::fidl_next::UnknownStrictEnumMemberError> {
433 match value {
434 1 => Ok(Self::None),
435 2 => Ok(Self::CtsRts),
436
437 _ => Err(::fidl_next::UnknownStrictEnumMemberError::new(value.into())),
438 }
439 }
440 }
441
442 impl ::std::convert::From<FlowControl> for u8 {
443 fn from(value: FlowControl) -> Self {
444 match value {
445 FlowControl::None => 1,
446 FlowControl::CtsRts => 2,
447 }
448 }
449 }
450
451 unsafe impl<___E> ::fidl_next::Encode<crate::wire::FlowControl, ___E> for FlowControl
452 where
453 ___E: ?Sized,
454 {
455 #[inline]
456 fn encode(
457 self,
458 encoder: &mut ___E,
459 out: &mut ::core::mem::MaybeUninit<crate::wire::FlowControl>,
460 _: (),
461 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
462 ::fidl_next::Encode::encode(&self, encoder, out, ())
463 }
464 }
465
466 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::FlowControl, ___E> for &'a FlowControl
467 where
468 ___E: ?Sized,
469 {
470 #[inline]
471 fn encode(
472 self,
473 encoder: &mut ___E,
474 out: &mut ::core::mem::MaybeUninit<crate::wire::FlowControl>,
475 _: (),
476 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
477 ::fidl_next::munge!(let crate::wire::FlowControl { value } = out);
478 let _ = value.write(u8::from(match *self {
479 FlowControl::None => 1,
480
481 FlowControl::CtsRts => 2,
482 }));
483
484 Ok(())
485 }
486 }
487
488 impl ::core::convert::From<crate::wire::FlowControl> for FlowControl {
489 fn from(wire: crate::wire::FlowControl) -> Self {
490 match u8::from(wire.value) {
491 1 => Self::None,
492
493 2 => Self::CtsRts,
494
495 _ => unsafe { ::core::hint::unreachable_unchecked() },
496 }
497 }
498 }
499
500 impl ::fidl_next::FromWire<crate::wire::FlowControl> for FlowControl {
501 #[inline]
502 fn from_wire(wire: crate::wire::FlowControl) -> Self {
503 Self::from(wire)
504 }
505 }
506
507 impl ::fidl_next::FromWireRef<crate::wire::FlowControl> for FlowControl {
508 #[inline]
509 fn from_wire_ref(wire: &crate::wire::FlowControl) -> Self {
510 Self::from(*wire)
511 }
512 }
513
514 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
515 #[repr(C)]
516 pub struct Config {
517 pub character_width: crate::natural::CharacterWidth,
518
519 pub stop_width: crate::natural::StopWidth,
520
521 pub parity: crate::natural::Parity,
522
523 pub control_flow: crate::natural::FlowControl,
524
525 pub baud_rate: u32,
526 }
527
528 unsafe impl<___E> ::fidl_next::Encode<crate::wire::Config, ___E> for Config
529 where
530 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
531 {
532 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self, crate::wire::Config> = unsafe {
533 ::fidl_next::CopyOptimization::enable_if(
534 true
535
536 && <
537 crate::natural::CharacterWidth as ::fidl_next::Encode<crate::wire::CharacterWidth, ___E>
538 >::COPY_OPTIMIZATION.is_enabled()
539
540 && <
541 crate::natural::StopWidth as ::fidl_next::Encode<crate::wire::StopWidth, ___E>
542 >::COPY_OPTIMIZATION.is_enabled()
543
544 && <
545 crate::natural::Parity as ::fidl_next::Encode<crate::wire::Parity, ___E>
546 >::COPY_OPTIMIZATION.is_enabled()
547
548 && <
549 crate::natural::FlowControl as ::fidl_next::Encode<crate::wire::FlowControl, ___E>
550 >::COPY_OPTIMIZATION.is_enabled()
551
552 && <
553 u32 as ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>
554 >::COPY_OPTIMIZATION.is_enabled()
555
556 )
557 };
558
559 #[inline]
560 fn encode(
561 self,
562 encoder_: &mut ___E,
563 out_: &mut ::core::mem::MaybeUninit<crate::wire::Config>,
564 _: (),
565 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
566 ::fidl_next::munge! {
567 let crate::wire::Config {
568 character_width,
569 stop_width,
570 parity,
571 control_flow,
572 baud_rate,
573
574 } = out_;
575 }
576
577 ::fidl_next::Encode::encode(self.character_width, encoder_, character_width, ())?;
578
579 let mut _field =
580 unsafe { ::fidl_next::Slot::new_unchecked(character_width.as_mut_ptr()) };
581
582 ::fidl_next::Encode::encode(self.stop_width, encoder_, stop_width, ())?;
583
584 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(stop_width.as_mut_ptr()) };
585
586 ::fidl_next::Encode::encode(self.parity, encoder_, parity, ())?;
587
588 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(parity.as_mut_ptr()) };
589
590 ::fidl_next::Encode::encode(self.control_flow, encoder_, control_flow, ())?;
591
592 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(control_flow.as_mut_ptr()) };
593
594 ::fidl_next::Encode::encode(self.baud_rate, encoder_, baud_rate, ())?;
595
596 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(baud_rate.as_mut_ptr()) };
597
598 Ok(())
599 }
600 }
601
602 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::Config, ___E> for &'a Config
603 where
604 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
605 {
606 #[inline]
607 fn encode(
608 self,
609 encoder_: &mut ___E,
610 out_: &mut ::core::mem::MaybeUninit<crate::wire::Config>,
611 _: (),
612 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
613 ::fidl_next::munge! {
614 let crate::wire::Config {
615 character_width,
616 stop_width,
617 parity,
618 control_flow,
619 baud_rate,
620
621 } = out_;
622 }
623
624 ::fidl_next::Encode::encode(&self.character_width, encoder_, character_width, ())?;
625
626 let mut _field =
627 unsafe { ::fidl_next::Slot::new_unchecked(character_width.as_mut_ptr()) };
628
629 ::fidl_next::Encode::encode(&self.stop_width, encoder_, stop_width, ())?;
630
631 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(stop_width.as_mut_ptr()) };
632
633 ::fidl_next::Encode::encode(&self.parity, encoder_, parity, ())?;
634
635 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(parity.as_mut_ptr()) };
636
637 ::fidl_next::Encode::encode(&self.control_flow, encoder_, control_flow, ())?;
638
639 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(control_flow.as_mut_ptr()) };
640
641 ::fidl_next::Encode::encode(&self.baud_rate, encoder_, baud_rate, ())?;
642
643 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(baud_rate.as_mut_ptr()) };
644
645 Ok(())
646 }
647 }
648
649 unsafe impl<___E>
650 ::fidl_next::EncodeOption<::fidl_next::wire::Box<'static, crate::wire::Config>, ___E>
651 for Config
652 where
653 ___E: ::fidl_next::Encoder + ?Sized,
654 Config: ::fidl_next::Encode<crate::wire::Config, ___E>,
655 {
656 #[inline]
657 fn encode_option(
658 this: ::core::option::Option<Self>,
659 encoder: &mut ___E,
660 out: &mut ::core::mem::MaybeUninit<
661 ::fidl_next::wire::Box<'static, crate::wire::Config>,
662 >,
663 _: (),
664 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
665 if let Some(inner) = this {
666 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
667 ::fidl_next::wire::Box::encode_present(out);
668 } else {
669 ::fidl_next::wire::Box::encode_absent(out);
670 }
671
672 Ok(())
673 }
674 }
675
676 unsafe impl<'a, ___E>
677 ::fidl_next::EncodeOption<::fidl_next::wire::Box<'static, crate::wire::Config>, ___E>
678 for &'a Config
679 where
680 ___E: ::fidl_next::Encoder + ?Sized,
681 &'a Config: ::fidl_next::Encode<crate::wire::Config, ___E>,
682 {
683 #[inline]
684 fn encode_option(
685 this: ::core::option::Option<Self>,
686 encoder: &mut ___E,
687 out: &mut ::core::mem::MaybeUninit<
688 ::fidl_next::wire::Box<'static, crate::wire::Config>,
689 >,
690 _: (),
691 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
692 if let Some(inner) = this {
693 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
694 ::fidl_next::wire::Box::encode_present(out);
695 } else {
696 ::fidl_next::wire::Box::encode_absent(out);
697 }
698
699 Ok(())
700 }
701 }
702
703 impl ::fidl_next::FromWire<crate::wire::Config> for Config {
704 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<crate::wire::Config, Self> = unsafe {
705 ::fidl_next::CopyOptimization::enable_if(
706 true
707
708 && <
709 crate::natural::CharacterWidth as ::fidl_next::FromWire<crate::wire::CharacterWidth>
710 >::COPY_OPTIMIZATION.is_enabled()
711
712 && <
713 crate::natural::StopWidth as ::fidl_next::FromWire<crate::wire::StopWidth>
714 >::COPY_OPTIMIZATION.is_enabled()
715
716 && <
717 crate::natural::Parity as ::fidl_next::FromWire<crate::wire::Parity>
718 >::COPY_OPTIMIZATION.is_enabled()
719
720 && <
721 crate::natural::FlowControl as ::fidl_next::FromWire<crate::wire::FlowControl>
722 >::COPY_OPTIMIZATION.is_enabled()
723
724 && <
725 u32 as ::fidl_next::FromWire<::fidl_next::wire::Uint32>
726 >::COPY_OPTIMIZATION.is_enabled()
727
728 )
729 };
730
731 #[inline]
732 fn from_wire(wire: crate::wire::Config) -> Self {
733 Self {
734 character_width: ::fidl_next::FromWire::from_wire(wire.character_width),
735
736 stop_width: ::fidl_next::FromWire::from_wire(wire.stop_width),
737
738 parity: ::fidl_next::FromWire::from_wire(wire.parity),
739
740 control_flow: ::fidl_next::FromWire::from_wire(wire.control_flow),
741
742 baud_rate: ::fidl_next::FromWire::from_wire(wire.baud_rate),
743 }
744 }
745 }
746
747 impl ::fidl_next::FromWireRef<crate::wire::Config> for Config {
748 #[inline]
749 fn from_wire_ref(wire: &crate::wire::Config) -> Self {
750 Self {
751 character_width: ::fidl_next::FromWireRef::from_wire_ref(&wire.character_width),
752
753 stop_width: ::fidl_next::FromWireRef::from_wire_ref(&wire.stop_width),
754
755 parity: ::fidl_next::FromWireRef::from_wire_ref(&wire.parity),
756
757 control_flow: ::fidl_next::FromWireRef::from_wire_ref(&wire.control_flow),
758
759 baud_rate: ::fidl_next::FromWireRef::from_wire_ref(&wire.baud_rate),
760 }
761 }
762 }
763
764 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
765 #[repr(C)]
766 pub struct DeviceGetClassResponse {
767 pub device_class: crate::natural::Class,
768 }
769
770 unsafe impl<___E> ::fidl_next::Encode<crate::wire::DeviceGetClassResponse, ___E>
771 for DeviceGetClassResponse
772 where
773 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
774 {
775 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
776 Self,
777 crate::wire::DeviceGetClassResponse,
778 > = unsafe {
779 ::fidl_next::CopyOptimization::enable_if(
780 true
781
782 && <
783 crate::natural::Class as ::fidl_next::Encode<crate::wire::Class, ___E>
784 >::COPY_OPTIMIZATION.is_enabled()
785
786 )
787 };
788
789 #[inline]
790 fn encode(
791 self,
792 encoder_: &mut ___E,
793 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetClassResponse>,
794 _: (),
795 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
796 ::fidl_next::munge! {
797 let crate::wire::DeviceGetClassResponse {
798 device_class,
799
800 } = out_;
801 }
802
803 ::fidl_next::Encode::encode(self.device_class, encoder_, device_class, ())?;
804
805 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(device_class.as_mut_ptr()) };
806
807 Ok(())
808 }
809 }
810
811 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DeviceGetClassResponse, ___E>
812 for &'a DeviceGetClassResponse
813 where
814 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
815 {
816 #[inline]
817 fn encode(
818 self,
819 encoder_: &mut ___E,
820 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetClassResponse>,
821 _: (),
822 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
823 ::fidl_next::munge! {
824 let crate::wire::DeviceGetClassResponse {
825 device_class,
826
827 } = out_;
828 }
829
830 ::fidl_next::Encode::encode(&self.device_class, encoder_, device_class, ())?;
831
832 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(device_class.as_mut_ptr()) };
833
834 Ok(())
835 }
836 }
837
838 unsafe impl<___E>
839 ::fidl_next::EncodeOption<
840 ::fidl_next::wire::Box<'static, crate::wire::DeviceGetClassResponse>,
841 ___E,
842 > for DeviceGetClassResponse
843 where
844 ___E: ::fidl_next::Encoder + ?Sized,
845 DeviceGetClassResponse: ::fidl_next::Encode<crate::wire::DeviceGetClassResponse, ___E>,
846 {
847 #[inline]
848 fn encode_option(
849 this: ::core::option::Option<Self>,
850 encoder: &mut ___E,
851 out: &mut ::core::mem::MaybeUninit<
852 ::fidl_next::wire::Box<'static, crate::wire::DeviceGetClassResponse>,
853 >,
854 _: (),
855 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
856 if let Some(inner) = this {
857 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
858 ::fidl_next::wire::Box::encode_present(out);
859 } else {
860 ::fidl_next::wire::Box::encode_absent(out);
861 }
862
863 Ok(())
864 }
865 }
866
867 unsafe impl<'a, ___E>
868 ::fidl_next::EncodeOption<
869 ::fidl_next::wire::Box<'static, crate::wire::DeviceGetClassResponse>,
870 ___E,
871 > for &'a DeviceGetClassResponse
872 where
873 ___E: ::fidl_next::Encoder + ?Sized,
874 &'a DeviceGetClassResponse: ::fidl_next::Encode<crate::wire::DeviceGetClassResponse, ___E>,
875 {
876 #[inline]
877 fn encode_option(
878 this: ::core::option::Option<Self>,
879 encoder: &mut ___E,
880 out: &mut ::core::mem::MaybeUninit<
881 ::fidl_next::wire::Box<'static, crate::wire::DeviceGetClassResponse>,
882 >,
883 _: (),
884 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
885 if let Some(inner) = this {
886 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
887 ::fidl_next::wire::Box::encode_present(out);
888 } else {
889 ::fidl_next::wire::Box::encode_absent(out);
890 }
891
892 Ok(())
893 }
894 }
895
896 impl ::fidl_next::FromWire<crate::wire::DeviceGetClassResponse> for DeviceGetClassResponse {
897 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
898 crate::wire::DeviceGetClassResponse,
899 Self,
900 > = unsafe {
901 ::fidl_next::CopyOptimization::enable_if(
902 true
903
904 && <
905 crate::natural::Class as ::fidl_next::FromWire<crate::wire::Class>
906 >::COPY_OPTIMIZATION.is_enabled()
907
908 )
909 };
910
911 #[inline]
912 fn from_wire(wire: crate::wire::DeviceGetClassResponse) -> Self {
913 Self { device_class: ::fidl_next::FromWire::from_wire(wire.device_class) }
914 }
915 }
916
917 impl ::fidl_next::FromWireRef<crate::wire::DeviceGetClassResponse> for DeviceGetClassResponse {
918 #[inline]
919 fn from_wire_ref(wire: &crate::wire::DeviceGetClassResponse) -> Self {
920 Self { device_class: ::fidl_next::FromWireRef::from_wire_ref(&wire.device_class) }
921 }
922 }
923
924 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
925 #[repr(C)]
926 pub struct DeviceSetConfigRequest {
927 pub config: crate::natural::Config,
928 }
929
930 unsafe impl<___E> ::fidl_next::Encode<crate::wire::DeviceSetConfigRequest, ___E>
931 for DeviceSetConfigRequest
932 where
933 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
934 {
935 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
936 Self,
937 crate::wire::DeviceSetConfigRequest,
938 > = unsafe {
939 ::fidl_next::CopyOptimization::enable_if(
940 true && <crate::natural::Config as ::fidl_next::Encode<
941 crate::wire::Config,
942 ___E,
943 >>::COPY_OPTIMIZATION
944 .is_enabled(),
945 )
946 };
947
948 #[inline]
949 fn encode(
950 self,
951 encoder_: &mut ___E,
952 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceSetConfigRequest>,
953 _: (),
954 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
955 ::fidl_next::munge! {
956 let crate::wire::DeviceSetConfigRequest {
957 config,
958
959 } = out_;
960 }
961
962 ::fidl_next::Encode::encode(self.config, encoder_, config, ())?;
963
964 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(config.as_mut_ptr()) };
965
966 Ok(())
967 }
968 }
969
970 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DeviceSetConfigRequest, ___E>
971 for &'a DeviceSetConfigRequest
972 where
973 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
974 {
975 #[inline]
976 fn encode(
977 self,
978 encoder_: &mut ___E,
979 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceSetConfigRequest>,
980 _: (),
981 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
982 ::fidl_next::munge! {
983 let crate::wire::DeviceSetConfigRequest {
984 config,
985
986 } = out_;
987 }
988
989 ::fidl_next::Encode::encode(&self.config, encoder_, config, ())?;
990
991 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(config.as_mut_ptr()) };
992
993 Ok(())
994 }
995 }
996
997 unsafe impl<___E>
998 ::fidl_next::EncodeOption<
999 ::fidl_next::wire::Box<'static, crate::wire::DeviceSetConfigRequest>,
1000 ___E,
1001 > for DeviceSetConfigRequest
1002 where
1003 ___E: ::fidl_next::Encoder + ?Sized,
1004 DeviceSetConfigRequest: ::fidl_next::Encode<crate::wire::DeviceSetConfigRequest, ___E>,
1005 {
1006 #[inline]
1007 fn encode_option(
1008 this: ::core::option::Option<Self>,
1009 encoder: &mut ___E,
1010 out: &mut ::core::mem::MaybeUninit<
1011 ::fidl_next::wire::Box<'static, crate::wire::DeviceSetConfigRequest>,
1012 >,
1013 _: (),
1014 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1015 if let Some(inner) = this {
1016 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1017 ::fidl_next::wire::Box::encode_present(out);
1018 } else {
1019 ::fidl_next::wire::Box::encode_absent(out);
1020 }
1021
1022 Ok(())
1023 }
1024 }
1025
1026 unsafe impl<'a, ___E>
1027 ::fidl_next::EncodeOption<
1028 ::fidl_next::wire::Box<'static, crate::wire::DeviceSetConfigRequest>,
1029 ___E,
1030 > for &'a DeviceSetConfigRequest
1031 where
1032 ___E: ::fidl_next::Encoder + ?Sized,
1033 &'a DeviceSetConfigRequest: ::fidl_next::Encode<crate::wire::DeviceSetConfigRequest, ___E>,
1034 {
1035 #[inline]
1036 fn encode_option(
1037 this: ::core::option::Option<Self>,
1038 encoder: &mut ___E,
1039 out: &mut ::core::mem::MaybeUninit<
1040 ::fidl_next::wire::Box<'static, crate::wire::DeviceSetConfigRequest>,
1041 >,
1042 _: (),
1043 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1044 if let Some(inner) = this {
1045 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1046 ::fidl_next::wire::Box::encode_present(out);
1047 } else {
1048 ::fidl_next::wire::Box::encode_absent(out);
1049 }
1050
1051 Ok(())
1052 }
1053 }
1054
1055 impl ::fidl_next::FromWire<crate::wire::DeviceSetConfigRequest> for DeviceSetConfigRequest {
1056 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
1057 crate::wire::DeviceSetConfigRequest,
1058 Self,
1059 > = unsafe {
1060 ::fidl_next::CopyOptimization::enable_if(
1061 true && <crate::natural::Config as ::fidl_next::FromWire<
1062 crate::wire::Config,
1063 >>::COPY_OPTIMIZATION
1064 .is_enabled(),
1065 )
1066 };
1067
1068 #[inline]
1069 fn from_wire(wire: crate::wire::DeviceSetConfigRequest) -> Self {
1070 Self { config: ::fidl_next::FromWire::from_wire(wire.config) }
1071 }
1072 }
1073
1074 impl ::fidl_next::FromWireRef<crate::wire::DeviceSetConfigRequest> for DeviceSetConfigRequest {
1075 #[inline]
1076 fn from_wire_ref(wire: &crate::wire::DeviceSetConfigRequest) -> Self {
1077 Self { config: ::fidl_next::FromWireRef::from_wire_ref(&wire.config) }
1078 }
1079 }
1080
1081 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
1082 #[repr(C)]
1083 pub struct DeviceSetConfigResponse {
1084 pub s: ::core::result::Result<(), ::fidl_next::fuchsia::zx::Status>,
1085 }
1086
1087 unsafe impl<___E> ::fidl_next::Encode<crate::wire::DeviceSetConfigResponse, ___E>
1088 for DeviceSetConfigResponse
1089 where
1090 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1091 {
1092 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
1093 Self,
1094 crate::wire::DeviceSetConfigResponse,
1095 > = unsafe {
1096 ::fidl_next::CopyOptimization::enable_if(
1097 true
1098
1099 && <
1100 ::core::result::Result<(), ::fidl_next::fuchsia::zx::Status> as ::fidl_next::Encode<::fidl_next::wire::fuchsia::StatusResult, ___E>
1101 >::COPY_OPTIMIZATION.is_enabled()
1102
1103 )
1104 };
1105
1106 #[inline]
1107 fn encode(
1108 self,
1109 encoder_: &mut ___E,
1110 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceSetConfigResponse>,
1111 _: (),
1112 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1113 ::fidl_next::munge! {
1114 let crate::wire::DeviceSetConfigResponse {
1115 s,
1116
1117 } = out_;
1118 }
1119
1120 ::fidl_next::Encode::encode(self.s, encoder_, s, ())?;
1121
1122 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(s.as_mut_ptr()) };
1123
1124 Ok(())
1125 }
1126 }
1127
1128 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DeviceSetConfigResponse, ___E>
1129 for &'a DeviceSetConfigResponse
1130 where
1131 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1132 {
1133 #[inline]
1134 fn encode(
1135 self,
1136 encoder_: &mut ___E,
1137 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceSetConfigResponse>,
1138 _: (),
1139 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1140 ::fidl_next::munge! {
1141 let crate::wire::DeviceSetConfigResponse {
1142 s,
1143
1144 } = out_;
1145 }
1146
1147 ::fidl_next::Encode::encode(&self.s, encoder_, s, ())?;
1148
1149 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(s.as_mut_ptr()) };
1150
1151 Ok(())
1152 }
1153 }
1154
1155 unsafe impl<___E>
1156 ::fidl_next::EncodeOption<
1157 ::fidl_next::wire::Box<'static, crate::wire::DeviceSetConfigResponse>,
1158 ___E,
1159 > for DeviceSetConfigResponse
1160 where
1161 ___E: ::fidl_next::Encoder + ?Sized,
1162 DeviceSetConfigResponse: ::fidl_next::Encode<crate::wire::DeviceSetConfigResponse, ___E>,
1163 {
1164 #[inline]
1165 fn encode_option(
1166 this: ::core::option::Option<Self>,
1167 encoder: &mut ___E,
1168 out: &mut ::core::mem::MaybeUninit<
1169 ::fidl_next::wire::Box<'static, crate::wire::DeviceSetConfigResponse>,
1170 >,
1171 _: (),
1172 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1173 if let Some(inner) = this {
1174 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1175 ::fidl_next::wire::Box::encode_present(out);
1176 } else {
1177 ::fidl_next::wire::Box::encode_absent(out);
1178 }
1179
1180 Ok(())
1181 }
1182 }
1183
1184 unsafe impl<'a, ___E>
1185 ::fidl_next::EncodeOption<
1186 ::fidl_next::wire::Box<'static, crate::wire::DeviceSetConfigResponse>,
1187 ___E,
1188 > for &'a DeviceSetConfigResponse
1189 where
1190 ___E: ::fidl_next::Encoder + ?Sized,
1191 &'a DeviceSetConfigResponse:
1192 ::fidl_next::Encode<crate::wire::DeviceSetConfigResponse, ___E>,
1193 {
1194 #[inline]
1195 fn encode_option(
1196 this: ::core::option::Option<Self>,
1197 encoder: &mut ___E,
1198 out: &mut ::core::mem::MaybeUninit<
1199 ::fidl_next::wire::Box<'static, crate::wire::DeviceSetConfigResponse>,
1200 >,
1201 _: (),
1202 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1203 if let Some(inner) = this {
1204 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1205 ::fidl_next::wire::Box::encode_present(out);
1206 } else {
1207 ::fidl_next::wire::Box::encode_absent(out);
1208 }
1209
1210 Ok(())
1211 }
1212 }
1213
1214 impl ::fidl_next::FromWire<crate::wire::DeviceSetConfigResponse> for DeviceSetConfigResponse {
1215 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
1216 crate::wire::DeviceSetConfigResponse,
1217 Self,
1218 > = unsafe {
1219 ::fidl_next::CopyOptimization::enable_if(
1220 true
1221
1222 && <
1223 ::core::result::Result<(), ::fidl_next::fuchsia::zx::Status> as ::fidl_next::FromWire<::fidl_next::wire::fuchsia::StatusResult>
1224 >::COPY_OPTIMIZATION.is_enabled()
1225
1226 )
1227 };
1228
1229 #[inline]
1230 fn from_wire(wire: crate::wire::DeviceSetConfigResponse) -> Self {
1231 Self { s: ::fidl_next::FromWire::from_wire(wire.s) }
1232 }
1233 }
1234
1235 impl ::fidl_next::FromWireRef<crate::wire::DeviceSetConfigResponse> for DeviceSetConfigResponse {
1236 #[inline]
1237 fn from_wire_ref(wire: &crate::wire::DeviceSetConfigResponse) -> Self {
1238 Self { s: ::fidl_next::FromWireRef::from_wire_ref(&wire.s) }
1239 }
1240 }
1241
1242 #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
1243 pub struct DeviceReadResponse {
1244 pub data: ::std::vec::Vec<u8>,
1245 }
1246
1247 unsafe impl<___E> ::fidl_next::Encode<crate::wire::DeviceReadResponse<'static>, ___E>
1248 for DeviceReadResponse
1249 where
1250 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1251 ___E: ::fidl_next::Encoder,
1252 {
1253 #[inline]
1254 fn encode(
1255 self,
1256 encoder_: &mut ___E,
1257 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceReadResponse<'static>>,
1258 _: (),
1259 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1260 ::fidl_next::munge! {
1261 let crate::wire::DeviceReadResponse {
1262 data,
1263
1264 } = out_;
1265 }
1266
1267 ::fidl_next::Encode::encode(self.data, encoder_, data, (4294967295, ()))?;
1268
1269 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(data.as_mut_ptr()) };
1270 ::fidl_next::Constrained::validate(_field, (4294967295, ()))?;
1271
1272 Ok(())
1273 }
1274 }
1275
1276 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DeviceReadResponse<'static>, ___E>
1277 for &'a DeviceReadResponse
1278 where
1279 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1280 ___E: ::fidl_next::Encoder,
1281 {
1282 #[inline]
1283 fn encode(
1284 self,
1285 encoder_: &mut ___E,
1286 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceReadResponse<'static>>,
1287 _: (),
1288 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1289 ::fidl_next::munge! {
1290 let crate::wire::DeviceReadResponse {
1291 data,
1292
1293 } = out_;
1294 }
1295
1296 ::fidl_next::Encode::encode(&self.data, encoder_, data, (4294967295, ()))?;
1297
1298 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(data.as_mut_ptr()) };
1299 ::fidl_next::Constrained::validate(_field, (4294967295, ()))?;
1300
1301 Ok(())
1302 }
1303 }
1304
1305 unsafe impl<___E>
1306 ::fidl_next::EncodeOption<
1307 ::fidl_next::wire::Box<'static, crate::wire::DeviceReadResponse<'static>>,
1308 ___E,
1309 > for DeviceReadResponse
1310 where
1311 ___E: ::fidl_next::Encoder + ?Sized,
1312 DeviceReadResponse: ::fidl_next::Encode<crate::wire::DeviceReadResponse<'static>, ___E>,
1313 {
1314 #[inline]
1315 fn encode_option(
1316 this: ::core::option::Option<Self>,
1317 encoder: &mut ___E,
1318 out: &mut ::core::mem::MaybeUninit<
1319 ::fidl_next::wire::Box<'static, crate::wire::DeviceReadResponse<'static>>,
1320 >,
1321 _: (),
1322 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1323 if let Some(inner) = this {
1324 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1325 ::fidl_next::wire::Box::encode_present(out);
1326 } else {
1327 ::fidl_next::wire::Box::encode_absent(out);
1328 }
1329
1330 Ok(())
1331 }
1332 }
1333
1334 unsafe impl<'a, ___E>
1335 ::fidl_next::EncodeOption<
1336 ::fidl_next::wire::Box<'static, crate::wire::DeviceReadResponse<'static>>,
1337 ___E,
1338 > for &'a DeviceReadResponse
1339 where
1340 ___E: ::fidl_next::Encoder + ?Sized,
1341 &'a DeviceReadResponse: ::fidl_next::Encode<crate::wire::DeviceReadResponse<'static>, ___E>,
1342 {
1343 #[inline]
1344 fn encode_option(
1345 this: ::core::option::Option<Self>,
1346 encoder: &mut ___E,
1347 out: &mut ::core::mem::MaybeUninit<
1348 ::fidl_next::wire::Box<'static, crate::wire::DeviceReadResponse<'static>>,
1349 >,
1350 _: (),
1351 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1352 if let Some(inner) = this {
1353 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1354 ::fidl_next::wire::Box::encode_present(out);
1355 } else {
1356 ::fidl_next::wire::Box::encode_absent(out);
1357 }
1358
1359 Ok(())
1360 }
1361 }
1362
1363 impl<'de> ::fidl_next::FromWire<crate::wire::DeviceReadResponse<'de>> for DeviceReadResponse {
1364 #[inline]
1365 fn from_wire(wire: crate::wire::DeviceReadResponse<'de>) -> Self {
1366 Self { data: ::fidl_next::FromWire::from_wire(wire.data) }
1367 }
1368 }
1369
1370 impl<'de> ::fidl_next::FromWireRef<crate::wire::DeviceReadResponse<'de>> for DeviceReadResponse {
1371 #[inline]
1372 fn from_wire_ref(wire: &crate::wire::DeviceReadResponse<'de>) -> Self {
1373 Self { data: ::fidl_next::FromWireRef::from_wire_ref(&wire.data) }
1374 }
1375 }
1376
1377 #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
1378 pub struct DeviceWriteRequest {
1379 pub data: ::std::vec::Vec<u8>,
1380 }
1381
1382 unsafe impl<___E> ::fidl_next::Encode<crate::wire::DeviceWriteRequest<'static>, ___E>
1383 for DeviceWriteRequest
1384 where
1385 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1386 ___E: ::fidl_next::Encoder,
1387 {
1388 #[inline]
1389 fn encode(
1390 self,
1391 encoder_: &mut ___E,
1392 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceWriteRequest<'static>>,
1393 _: (),
1394 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1395 ::fidl_next::munge! {
1396 let crate::wire::DeviceWriteRequest {
1397 data,
1398
1399 } = out_;
1400 }
1401
1402 ::fidl_next::Encode::encode(self.data, encoder_, data, (4294967295, ()))?;
1403
1404 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(data.as_mut_ptr()) };
1405 ::fidl_next::Constrained::validate(_field, (4294967295, ()))?;
1406
1407 Ok(())
1408 }
1409 }
1410
1411 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DeviceWriteRequest<'static>, ___E>
1412 for &'a DeviceWriteRequest
1413 where
1414 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1415 ___E: ::fidl_next::Encoder,
1416 {
1417 #[inline]
1418 fn encode(
1419 self,
1420 encoder_: &mut ___E,
1421 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceWriteRequest<'static>>,
1422 _: (),
1423 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1424 ::fidl_next::munge! {
1425 let crate::wire::DeviceWriteRequest {
1426 data,
1427
1428 } = out_;
1429 }
1430
1431 ::fidl_next::Encode::encode(&self.data, encoder_, data, (4294967295, ()))?;
1432
1433 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(data.as_mut_ptr()) };
1434 ::fidl_next::Constrained::validate(_field, (4294967295, ()))?;
1435
1436 Ok(())
1437 }
1438 }
1439
1440 unsafe impl<___E>
1441 ::fidl_next::EncodeOption<
1442 ::fidl_next::wire::Box<'static, crate::wire::DeviceWriteRequest<'static>>,
1443 ___E,
1444 > for DeviceWriteRequest
1445 where
1446 ___E: ::fidl_next::Encoder + ?Sized,
1447 DeviceWriteRequest: ::fidl_next::Encode<crate::wire::DeviceWriteRequest<'static>, ___E>,
1448 {
1449 #[inline]
1450 fn encode_option(
1451 this: ::core::option::Option<Self>,
1452 encoder: &mut ___E,
1453 out: &mut ::core::mem::MaybeUninit<
1454 ::fidl_next::wire::Box<'static, crate::wire::DeviceWriteRequest<'static>>,
1455 >,
1456 _: (),
1457 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1458 if let Some(inner) = this {
1459 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1460 ::fidl_next::wire::Box::encode_present(out);
1461 } else {
1462 ::fidl_next::wire::Box::encode_absent(out);
1463 }
1464
1465 Ok(())
1466 }
1467 }
1468
1469 unsafe impl<'a, ___E>
1470 ::fidl_next::EncodeOption<
1471 ::fidl_next::wire::Box<'static, crate::wire::DeviceWriteRequest<'static>>,
1472 ___E,
1473 > for &'a DeviceWriteRequest
1474 where
1475 ___E: ::fidl_next::Encoder + ?Sized,
1476 &'a DeviceWriteRequest: ::fidl_next::Encode<crate::wire::DeviceWriteRequest<'static>, ___E>,
1477 {
1478 #[inline]
1479 fn encode_option(
1480 this: ::core::option::Option<Self>,
1481 encoder: &mut ___E,
1482 out: &mut ::core::mem::MaybeUninit<
1483 ::fidl_next::wire::Box<'static, crate::wire::DeviceWriteRequest<'static>>,
1484 >,
1485 _: (),
1486 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1487 if let Some(inner) = this {
1488 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1489 ::fidl_next::wire::Box::encode_present(out);
1490 } else {
1491 ::fidl_next::wire::Box::encode_absent(out);
1492 }
1493
1494 Ok(())
1495 }
1496 }
1497
1498 impl<'de> ::fidl_next::FromWire<crate::wire::DeviceWriteRequest<'de>> for DeviceWriteRequest {
1499 #[inline]
1500 fn from_wire(wire: crate::wire::DeviceWriteRequest<'de>) -> Self {
1501 Self { data: ::fidl_next::FromWire::from_wire(wire.data) }
1502 }
1503 }
1504
1505 impl<'de> ::fidl_next::FromWireRef<crate::wire::DeviceWriteRequest<'de>> for DeviceWriteRequest {
1506 #[inline]
1507 fn from_wire_ref(wire: &crate::wire::DeviceWriteRequest<'de>) -> Self {
1508 Self { data: ::fidl_next::FromWireRef::from_wire_ref(&wire.data) }
1509 }
1510 }
1511
1512 pub type DeviceWriteResponse = ();
1513
1514 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
1515 pub struct SerialPortInfo {
1516 pub serial_class: crate::natural::Class,
1517
1518 pub serial_vid: u32,
1519
1520 pub serial_pid: u32,
1521 }
1522
1523 unsafe impl<___E> ::fidl_next::Encode<crate::wire::SerialPortInfo, ___E> for SerialPortInfo
1524 where
1525 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1526 {
1527 #[inline]
1528 fn encode(
1529 self,
1530 encoder_: &mut ___E,
1531 out_: &mut ::core::mem::MaybeUninit<crate::wire::SerialPortInfo>,
1532 _: (),
1533 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1534 ::fidl_next::munge! {
1535 let crate::wire::SerialPortInfo {
1536 serial_class,
1537 serial_vid,
1538 serial_pid,
1539
1540 } = out_;
1541 }
1542
1543 ::fidl_next::Encode::encode(self.serial_class, encoder_, serial_class, ())?;
1544
1545 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(serial_class.as_mut_ptr()) };
1546
1547 ::fidl_next::Encode::encode(self.serial_vid, encoder_, serial_vid, ())?;
1548
1549 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(serial_vid.as_mut_ptr()) };
1550
1551 ::fidl_next::Encode::encode(self.serial_pid, encoder_, serial_pid, ())?;
1552
1553 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(serial_pid.as_mut_ptr()) };
1554
1555 Ok(())
1556 }
1557 }
1558
1559 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::SerialPortInfo, ___E> for &'a SerialPortInfo
1560 where
1561 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1562 {
1563 #[inline]
1564 fn encode(
1565 self,
1566 encoder_: &mut ___E,
1567 out_: &mut ::core::mem::MaybeUninit<crate::wire::SerialPortInfo>,
1568 _: (),
1569 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1570 ::fidl_next::munge! {
1571 let crate::wire::SerialPortInfo {
1572 serial_class,
1573 serial_vid,
1574 serial_pid,
1575
1576 } = out_;
1577 }
1578
1579 ::fidl_next::Encode::encode(&self.serial_class, encoder_, serial_class, ())?;
1580
1581 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(serial_class.as_mut_ptr()) };
1582
1583 ::fidl_next::Encode::encode(&self.serial_vid, encoder_, serial_vid, ())?;
1584
1585 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(serial_vid.as_mut_ptr()) };
1586
1587 ::fidl_next::Encode::encode(&self.serial_pid, encoder_, serial_pid, ())?;
1588
1589 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(serial_pid.as_mut_ptr()) };
1590
1591 Ok(())
1592 }
1593 }
1594
1595 unsafe impl<___E>
1596 ::fidl_next::EncodeOption<
1597 ::fidl_next::wire::Box<'static, crate::wire::SerialPortInfo>,
1598 ___E,
1599 > for SerialPortInfo
1600 where
1601 ___E: ::fidl_next::Encoder + ?Sized,
1602 SerialPortInfo: ::fidl_next::Encode<crate::wire::SerialPortInfo, ___E>,
1603 {
1604 #[inline]
1605 fn encode_option(
1606 this: ::core::option::Option<Self>,
1607 encoder: &mut ___E,
1608 out: &mut ::core::mem::MaybeUninit<
1609 ::fidl_next::wire::Box<'static, crate::wire::SerialPortInfo>,
1610 >,
1611 _: (),
1612 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1613 if let Some(inner) = this {
1614 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1615 ::fidl_next::wire::Box::encode_present(out);
1616 } else {
1617 ::fidl_next::wire::Box::encode_absent(out);
1618 }
1619
1620 Ok(())
1621 }
1622 }
1623
1624 unsafe impl<'a, ___E>
1625 ::fidl_next::EncodeOption<
1626 ::fidl_next::wire::Box<'static, crate::wire::SerialPortInfo>,
1627 ___E,
1628 > for &'a SerialPortInfo
1629 where
1630 ___E: ::fidl_next::Encoder + ?Sized,
1631 &'a SerialPortInfo: ::fidl_next::Encode<crate::wire::SerialPortInfo, ___E>,
1632 {
1633 #[inline]
1634 fn encode_option(
1635 this: ::core::option::Option<Self>,
1636 encoder: &mut ___E,
1637 out: &mut ::core::mem::MaybeUninit<
1638 ::fidl_next::wire::Box<'static, crate::wire::SerialPortInfo>,
1639 >,
1640 _: (),
1641 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1642 if let Some(inner) = this {
1643 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1644 ::fidl_next::wire::Box::encode_present(out);
1645 } else {
1646 ::fidl_next::wire::Box::encode_absent(out);
1647 }
1648
1649 Ok(())
1650 }
1651 }
1652
1653 impl ::fidl_next::FromWire<crate::wire::SerialPortInfo> for SerialPortInfo {
1654 #[inline]
1655 fn from_wire(wire: crate::wire::SerialPortInfo) -> Self {
1656 Self {
1657 serial_class: ::fidl_next::FromWire::from_wire(wire.serial_class),
1658
1659 serial_vid: ::fidl_next::FromWire::from_wire(wire.serial_vid),
1660
1661 serial_pid: ::fidl_next::FromWire::from_wire(wire.serial_pid),
1662 }
1663 }
1664 }
1665
1666 impl ::fidl_next::FromWireRef<crate::wire::SerialPortInfo> for SerialPortInfo {
1667 #[inline]
1668 fn from_wire_ref(wire: &crate::wire::SerialPortInfo) -> Self {
1669 Self {
1670 serial_class: ::fidl_next::FromWireRef::from_wire_ref(&wire.serial_class),
1671
1672 serial_vid: ::fidl_next::FromWireRef::from_wire_ref(&wire.serial_vid),
1673
1674 serial_pid: ::fidl_next::FromWireRef::from_wire_ref(&wire.serial_pid),
1675 }
1676 }
1677 }
1678}
1679
1680pub mod wire {
1681
1682 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
1684 #[repr(transparent)]
1685 pub struct CharacterWidth {
1686 pub(crate) value: u8,
1687 }
1688
1689 impl ::fidl_next::Constrained for CharacterWidth {
1690 type Constraint = ();
1691
1692 fn validate(
1693 _: ::fidl_next::Slot<'_, Self>,
1694 _: Self::Constraint,
1695 ) -> Result<(), ::fidl_next::ValidationError> {
1696 Ok(())
1697 }
1698 }
1699
1700 unsafe impl ::fidl_next::Wire for CharacterWidth {
1701 type Narrowed<'de> = Self;
1702
1703 #[inline]
1704 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
1705 }
1707 }
1708
1709 impl CharacterWidth {
1710 pub const BITS_5: CharacterWidth = CharacterWidth { value: 1 };
1711
1712 pub const BITS_6: CharacterWidth = CharacterWidth { value: 2 };
1713
1714 pub const BITS_7: CharacterWidth = CharacterWidth { value: 3 };
1715
1716 pub const BITS_8: CharacterWidth = CharacterWidth { value: 4 };
1717 }
1718
1719 unsafe impl<___D> ::fidl_next::Decode<___D> for CharacterWidth
1720 where
1721 ___D: ?Sized,
1722 {
1723 fn decode(
1724 slot: ::fidl_next::Slot<'_, Self>,
1725 _: &mut ___D,
1726 _: (),
1727 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1728 ::fidl_next::munge!(let Self { value } = slot);
1729
1730 match u8::from(*value) {
1731 1 | 2 | 3 | 4 => (),
1732 unknown => {
1733 return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128));
1734 }
1735 }
1736
1737 Ok(())
1738 }
1739 }
1740
1741 impl ::core::convert::From<crate::natural::CharacterWidth> for CharacterWidth {
1742 fn from(natural: crate::natural::CharacterWidth) -> Self {
1743 match natural {
1744 crate::natural::CharacterWidth::Bits5 => CharacterWidth::BITS_5,
1745
1746 crate::natural::CharacterWidth::Bits6 => CharacterWidth::BITS_6,
1747
1748 crate::natural::CharacterWidth::Bits7 => CharacterWidth::BITS_7,
1749
1750 crate::natural::CharacterWidth::Bits8 => CharacterWidth::BITS_8,
1751 }
1752 }
1753 }
1754
1755 impl ::fidl_next::IntoNatural for CharacterWidth {
1756 type Natural = crate::natural::CharacterWidth;
1757 }
1758
1759 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
1761 #[repr(transparent)]
1762 pub struct Class {
1763 pub(crate) value: u8,
1764 }
1765
1766 impl ::fidl_next::Constrained for Class {
1767 type Constraint = ();
1768
1769 fn validate(
1770 _: ::fidl_next::Slot<'_, Self>,
1771 _: Self::Constraint,
1772 ) -> Result<(), ::fidl_next::ValidationError> {
1773 Ok(())
1774 }
1775 }
1776
1777 unsafe impl ::fidl_next::Wire for Class {
1778 type Narrowed<'de> = Self;
1779
1780 #[inline]
1781 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
1782 }
1784 }
1785
1786 impl Class {
1787 pub const GENERIC: Class = Class { value: 1 };
1788
1789 pub const BLUETOOTH_HCI: Class = Class { value: 2 };
1790
1791 pub const CONSOLE: Class = Class { value: 3 };
1792
1793 pub const KERNEL_DEBUG: Class = Class { value: 4 };
1794
1795 pub const MCU: Class = Class { value: 5 };
1796 }
1797
1798 unsafe impl<___D> ::fidl_next::Decode<___D> for Class
1799 where
1800 ___D: ?Sized,
1801 {
1802 fn decode(
1803 slot: ::fidl_next::Slot<'_, Self>,
1804 _: &mut ___D,
1805 _: (),
1806 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1807 ::fidl_next::munge!(let Self { value } = slot);
1808
1809 match u8::from(*value) {
1810 1 | 2 | 3 | 4 | 5 => (),
1811 unknown => {
1812 return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128));
1813 }
1814 }
1815
1816 Ok(())
1817 }
1818 }
1819
1820 impl ::core::convert::From<crate::natural::Class> for Class {
1821 fn from(natural: crate::natural::Class) -> Self {
1822 match natural {
1823 crate::natural::Class::Generic => Class::GENERIC,
1824
1825 crate::natural::Class::BluetoothHci => Class::BLUETOOTH_HCI,
1826
1827 crate::natural::Class::Console => Class::CONSOLE,
1828
1829 crate::natural::Class::KernelDebug => Class::KERNEL_DEBUG,
1830
1831 crate::natural::Class::Mcu => Class::MCU,
1832 }
1833 }
1834 }
1835
1836 impl ::fidl_next::IntoNatural for Class {
1837 type Natural = crate::natural::Class;
1838 }
1839
1840 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
1842 #[repr(transparent)]
1843 pub struct StopWidth {
1844 pub(crate) value: u8,
1845 }
1846
1847 impl ::fidl_next::Constrained for StopWidth {
1848 type Constraint = ();
1849
1850 fn validate(
1851 _: ::fidl_next::Slot<'_, Self>,
1852 _: Self::Constraint,
1853 ) -> Result<(), ::fidl_next::ValidationError> {
1854 Ok(())
1855 }
1856 }
1857
1858 unsafe impl ::fidl_next::Wire for StopWidth {
1859 type Narrowed<'de> = Self;
1860
1861 #[inline]
1862 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
1863 }
1865 }
1866
1867 impl StopWidth {
1868 pub const BITS_1: StopWidth = StopWidth { value: 1 };
1869
1870 pub const BITS_2: StopWidth = StopWidth { value: 2 };
1871 }
1872
1873 unsafe impl<___D> ::fidl_next::Decode<___D> for StopWidth
1874 where
1875 ___D: ?Sized,
1876 {
1877 fn decode(
1878 slot: ::fidl_next::Slot<'_, Self>,
1879 _: &mut ___D,
1880 _: (),
1881 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1882 ::fidl_next::munge!(let Self { value } = slot);
1883
1884 match u8::from(*value) {
1885 1 | 2 => (),
1886 unknown => {
1887 return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128));
1888 }
1889 }
1890
1891 Ok(())
1892 }
1893 }
1894
1895 impl ::core::convert::From<crate::natural::StopWidth> for StopWidth {
1896 fn from(natural: crate::natural::StopWidth) -> Self {
1897 match natural {
1898 crate::natural::StopWidth::Bits1 => StopWidth::BITS_1,
1899
1900 crate::natural::StopWidth::Bits2 => StopWidth::BITS_2,
1901 }
1902 }
1903 }
1904
1905 impl ::fidl_next::IntoNatural for StopWidth {
1906 type Natural = crate::natural::StopWidth;
1907 }
1908
1909 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
1911 #[repr(transparent)]
1912 pub struct Parity {
1913 pub(crate) value: u8,
1914 }
1915
1916 impl ::fidl_next::Constrained for Parity {
1917 type Constraint = ();
1918
1919 fn validate(
1920 _: ::fidl_next::Slot<'_, Self>,
1921 _: Self::Constraint,
1922 ) -> Result<(), ::fidl_next::ValidationError> {
1923 Ok(())
1924 }
1925 }
1926
1927 unsafe impl ::fidl_next::Wire for Parity {
1928 type Narrowed<'de> = Self;
1929
1930 #[inline]
1931 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
1932 }
1934 }
1935
1936 impl Parity {
1937 pub const NONE: Parity = Parity { value: 1 };
1938
1939 pub const EVEN: Parity = Parity { value: 2 };
1940
1941 pub const ODD: Parity = Parity { value: 3 };
1942 }
1943
1944 unsafe impl<___D> ::fidl_next::Decode<___D> for Parity
1945 where
1946 ___D: ?Sized,
1947 {
1948 fn decode(
1949 slot: ::fidl_next::Slot<'_, Self>,
1950 _: &mut ___D,
1951 _: (),
1952 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1953 ::fidl_next::munge!(let Self { value } = slot);
1954
1955 match u8::from(*value) {
1956 1 | 2 | 3 => (),
1957 unknown => {
1958 return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128));
1959 }
1960 }
1961
1962 Ok(())
1963 }
1964 }
1965
1966 impl ::core::convert::From<crate::natural::Parity> for Parity {
1967 fn from(natural: crate::natural::Parity) -> Self {
1968 match natural {
1969 crate::natural::Parity::None => Parity::NONE,
1970
1971 crate::natural::Parity::Even => Parity::EVEN,
1972
1973 crate::natural::Parity::Odd => Parity::ODD,
1974 }
1975 }
1976 }
1977
1978 impl ::fidl_next::IntoNatural for Parity {
1979 type Natural = crate::natural::Parity;
1980 }
1981
1982 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
1984 #[repr(transparent)]
1985 pub struct FlowControl {
1986 pub(crate) value: u8,
1987 }
1988
1989 impl ::fidl_next::Constrained for FlowControl {
1990 type Constraint = ();
1991
1992 fn validate(
1993 _: ::fidl_next::Slot<'_, Self>,
1994 _: Self::Constraint,
1995 ) -> Result<(), ::fidl_next::ValidationError> {
1996 Ok(())
1997 }
1998 }
1999
2000 unsafe impl ::fidl_next::Wire for FlowControl {
2001 type Narrowed<'de> = Self;
2002
2003 #[inline]
2004 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
2005 }
2007 }
2008
2009 impl FlowControl {
2010 pub const NONE: FlowControl = FlowControl { value: 1 };
2011
2012 pub const CTS_RTS: FlowControl = FlowControl { value: 2 };
2013 }
2014
2015 unsafe impl<___D> ::fidl_next::Decode<___D> for FlowControl
2016 where
2017 ___D: ?Sized,
2018 {
2019 fn decode(
2020 slot: ::fidl_next::Slot<'_, Self>,
2021 _: &mut ___D,
2022 _: (),
2023 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2024 ::fidl_next::munge!(let Self { value } = slot);
2025
2026 match u8::from(*value) {
2027 1 | 2 => (),
2028 unknown => {
2029 return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128));
2030 }
2031 }
2032
2033 Ok(())
2034 }
2035 }
2036
2037 impl ::core::convert::From<crate::natural::FlowControl> for FlowControl {
2038 fn from(natural: crate::natural::FlowControl) -> Self {
2039 match natural {
2040 crate::natural::FlowControl::None => FlowControl::NONE,
2041
2042 crate::natural::FlowControl::CtsRts => FlowControl::CTS_RTS,
2043 }
2044 }
2045 }
2046
2047 impl ::fidl_next::IntoNatural for FlowControl {
2048 type Natural = crate::natural::FlowControl;
2049 }
2050
2051 #[derive(Clone, Debug)]
2053 #[repr(C)]
2054 pub struct Config {
2055 pub character_width: crate::wire::CharacterWidth,
2056
2057 pub stop_width: crate::wire::StopWidth,
2058
2059 pub parity: crate::wire::Parity,
2060
2061 pub control_flow: crate::wire::FlowControl,
2062
2063 pub baud_rate: ::fidl_next::wire::Uint32,
2064 }
2065
2066 static_assertions::const_assert_eq!(std::mem::size_of::<Config>(), 8);
2067 static_assertions::const_assert_eq!(std::mem::align_of::<Config>(), 4);
2068
2069 static_assertions::const_assert_eq!(std::mem::offset_of!(Config, character_width), 0);
2070
2071 static_assertions::const_assert_eq!(std::mem::offset_of!(Config, stop_width), 1);
2072
2073 static_assertions::const_assert_eq!(std::mem::offset_of!(Config, parity), 2);
2074
2075 static_assertions::const_assert_eq!(std::mem::offset_of!(Config, control_flow), 3);
2076
2077 static_assertions::const_assert_eq!(std::mem::offset_of!(Config, baud_rate), 4);
2078
2079 impl ::fidl_next::Constrained for Config {
2080 type Constraint = ();
2081
2082 fn validate(
2083 _: ::fidl_next::Slot<'_, Self>,
2084 _: Self::Constraint,
2085 ) -> Result<(), ::fidl_next::ValidationError> {
2086 Ok(())
2087 }
2088 }
2089
2090 unsafe impl ::fidl_next::Wire for Config {
2091 type Narrowed<'de> = Config;
2092
2093 #[inline]
2094 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
2095 ::fidl_next::munge! {
2096 let Self {
2097 character_width,
2098 stop_width,
2099 parity,
2100 control_flow,
2101 baud_rate,
2102
2103 } = &mut *out_;
2104 }
2105
2106 ::fidl_next::Wire::zero_padding(character_width);
2107
2108 ::fidl_next::Wire::zero_padding(stop_width);
2109
2110 ::fidl_next::Wire::zero_padding(parity);
2111
2112 ::fidl_next::Wire::zero_padding(control_flow);
2113
2114 ::fidl_next::Wire::zero_padding(baud_rate);
2115 }
2116 }
2117
2118 unsafe impl<___D> ::fidl_next::Decode<___D> for Config
2119 where
2120 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
2121 {
2122 fn decode(
2123 slot_: ::fidl_next::Slot<'_, Self>,
2124 decoder_: &mut ___D,
2125 _: (),
2126 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2127 ::fidl_next::munge! {
2128 let Self {
2129 mut character_width,
2130 mut stop_width,
2131 mut parity,
2132 mut control_flow,
2133 mut baud_rate,
2134
2135 } = slot_;
2136 }
2137
2138 let _field = character_width.as_mut();
2139
2140 ::fidl_next::Decode::decode(character_width.as_mut(), decoder_, ())?;
2141
2142 let _field = stop_width.as_mut();
2143
2144 ::fidl_next::Decode::decode(stop_width.as_mut(), decoder_, ())?;
2145
2146 let _field = parity.as_mut();
2147
2148 ::fidl_next::Decode::decode(parity.as_mut(), decoder_, ())?;
2149
2150 let _field = control_flow.as_mut();
2151
2152 ::fidl_next::Decode::decode(control_flow.as_mut(), decoder_, ())?;
2153
2154 let _field = baud_rate.as_mut();
2155
2156 ::fidl_next::Decode::decode(baud_rate.as_mut(), decoder_, ())?;
2157
2158 Ok(())
2159 }
2160 }
2161
2162 impl ::fidl_next::IntoNatural for Config {
2163 type Natural = crate::natural::Config;
2164 }
2165
2166 #[derive(Clone, Debug)]
2168 #[repr(C)]
2169 pub struct DeviceGetClassResponse {
2170 pub device_class: crate::wire::Class,
2171 }
2172
2173 static_assertions::const_assert_eq!(std::mem::size_of::<DeviceGetClassResponse>(), 1);
2174 static_assertions::const_assert_eq!(std::mem::align_of::<DeviceGetClassResponse>(), 1);
2175
2176 static_assertions::const_assert_eq!(
2177 std::mem::offset_of!(DeviceGetClassResponse, device_class),
2178 0
2179 );
2180
2181 impl ::fidl_next::Constrained for DeviceGetClassResponse {
2182 type Constraint = ();
2183
2184 fn validate(
2185 _: ::fidl_next::Slot<'_, Self>,
2186 _: Self::Constraint,
2187 ) -> Result<(), ::fidl_next::ValidationError> {
2188 Ok(())
2189 }
2190 }
2191
2192 unsafe impl ::fidl_next::Wire for DeviceGetClassResponse {
2193 type Narrowed<'de> = DeviceGetClassResponse;
2194
2195 #[inline]
2196 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
2197 ::fidl_next::munge! {
2198 let Self {
2199 device_class,
2200
2201 } = &mut *out_;
2202 }
2203
2204 ::fidl_next::Wire::zero_padding(device_class);
2205 }
2206 }
2207
2208 unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceGetClassResponse
2209 where
2210 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
2211 {
2212 fn decode(
2213 slot_: ::fidl_next::Slot<'_, Self>,
2214 decoder_: &mut ___D,
2215 _: (),
2216 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2217 ::fidl_next::munge! {
2218 let Self {
2219 mut device_class,
2220
2221 } = slot_;
2222 }
2223
2224 let _field = device_class.as_mut();
2225
2226 ::fidl_next::Decode::decode(device_class.as_mut(), decoder_, ())?;
2227
2228 Ok(())
2229 }
2230 }
2231
2232 impl ::fidl_next::IntoNatural for DeviceGetClassResponse {
2233 type Natural = crate::natural::DeviceGetClassResponse;
2234 }
2235
2236 #[derive(Clone, Debug)]
2238 #[repr(C)]
2239 pub struct DeviceSetConfigRequest {
2240 pub config: crate::wire::Config,
2241 }
2242
2243 static_assertions::const_assert_eq!(std::mem::size_of::<DeviceSetConfigRequest>(), 8);
2244 static_assertions::const_assert_eq!(std::mem::align_of::<DeviceSetConfigRequest>(), 4);
2245
2246 static_assertions::const_assert_eq!(std::mem::offset_of!(DeviceSetConfigRequest, config), 0);
2247
2248 impl ::fidl_next::Constrained for DeviceSetConfigRequest {
2249 type Constraint = ();
2250
2251 fn validate(
2252 _: ::fidl_next::Slot<'_, Self>,
2253 _: Self::Constraint,
2254 ) -> Result<(), ::fidl_next::ValidationError> {
2255 Ok(())
2256 }
2257 }
2258
2259 unsafe impl ::fidl_next::Wire for DeviceSetConfigRequest {
2260 type Narrowed<'de> = DeviceSetConfigRequest;
2261
2262 #[inline]
2263 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
2264 ::fidl_next::munge! {
2265 let Self {
2266 config,
2267
2268 } = &mut *out_;
2269 }
2270
2271 ::fidl_next::Wire::zero_padding(config);
2272 }
2273 }
2274
2275 unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceSetConfigRequest
2276 where
2277 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
2278 {
2279 fn decode(
2280 slot_: ::fidl_next::Slot<'_, Self>,
2281 decoder_: &mut ___D,
2282 _: (),
2283 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2284 ::fidl_next::munge! {
2285 let Self {
2286 mut config,
2287
2288 } = slot_;
2289 }
2290
2291 let _field = config.as_mut();
2292
2293 ::fidl_next::Decode::decode(config.as_mut(), decoder_, ())?;
2294
2295 Ok(())
2296 }
2297 }
2298
2299 impl ::fidl_next::IntoNatural for DeviceSetConfigRequest {
2300 type Natural = crate::natural::DeviceSetConfigRequest;
2301 }
2302
2303 #[derive(Clone, Debug)]
2305 #[repr(C)]
2306 pub struct DeviceSetConfigResponse {
2307 pub s: ::fidl_next::wire::fuchsia::StatusResult,
2308 }
2309
2310 static_assertions::const_assert_eq!(std::mem::size_of::<DeviceSetConfigResponse>(), 4);
2311 static_assertions::const_assert_eq!(std::mem::align_of::<DeviceSetConfigResponse>(), 4);
2312
2313 static_assertions::const_assert_eq!(std::mem::offset_of!(DeviceSetConfigResponse, s), 0);
2314
2315 impl ::fidl_next::Constrained for DeviceSetConfigResponse {
2316 type Constraint = ();
2317
2318 fn validate(
2319 _: ::fidl_next::Slot<'_, Self>,
2320 _: Self::Constraint,
2321 ) -> Result<(), ::fidl_next::ValidationError> {
2322 Ok(())
2323 }
2324 }
2325
2326 unsafe impl ::fidl_next::Wire for DeviceSetConfigResponse {
2327 type Narrowed<'de> = DeviceSetConfigResponse;
2328
2329 #[inline]
2330 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
2331 ::fidl_next::munge! {
2332 let Self {
2333 s,
2334
2335 } = &mut *out_;
2336 }
2337
2338 ::fidl_next::Wire::zero_padding(s);
2339 }
2340 }
2341
2342 unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceSetConfigResponse
2343 where
2344 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
2345 {
2346 fn decode(
2347 slot_: ::fidl_next::Slot<'_, Self>,
2348 decoder_: &mut ___D,
2349 _: (),
2350 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2351 ::fidl_next::munge! {
2352 let Self {
2353 mut s,
2354
2355 } = slot_;
2356 }
2357
2358 let _field = s.as_mut();
2359
2360 ::fidl_next::Decode::decode(s.as_mut(), decoder_, ())?;
2361
2362 Ok(())
2363 }
2364 }
2365
2366 impl ::fidl_next::IntoNatural for DeviceSetConfigResponse {
2367 type Natural = crate::natural::DeviceSetConfigResponse;
2368 }
2369
2370 #[derive(Debug)]
2372 #[repr(C)]
2373 pub struct DeviceReadResponse<'de> {
2374 pub data: ::fidl_next::wire::Vector<'de, u8>,
2375 }
2376
2377 static_assertions::const_assert_eq!(std::mem::size_of::<DeviceReadResponse<'_>>(), 16);
2378 static_assertions::const_assert_eq!(std::mem::align_of::<DeviceReadResponse<'_>>(), 8);
2379
2380 static_assertions::const_assert_eq!(std::mem::offset_of!(DeviceReadResponse<'_>, data), 0);
2381
2382 impl ::fidl_next::Constrained for DeviceReadResponse<'_> {
2383 type Constraint = ();
2384
2385 fn validate(
2386 _: ::fidl_next::Slot<'_, Self>,
2387 _: Self::Constraint,
2388 ) -> Result<(), ::fidl_next::ValidationError> {
2389 Ok(())
2390 }
2391 }
2392
2393 unsafe impl ::fidl_next::Wire for DeviceReadResponse<'static> {
2394 type Narrowed<'de> = DeviceReadResponse<'de>;
2395
2396 #[inline]
2397 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
2398 ::fidl_next::munge! {
2399 let Self {
2400 data,
2401
2402 } = &mut *out_;
2403 }
2404
2405 ::fidl_next::Wire::zero_padding(data);
2406 }
2407 }
2408
2409 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for DeviceReadResponse<'de>
2410 where
2411 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
2412 ___D: ::fidl_next::Decoder<'de>,
2413 {
2414 fn decode(
2415 slot_: ::fidl_next::Slot<'_, Self>,
2416 decoder_: &mut ___D,
2417 _: (),
2418 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2419 ::fidl_next::munge! {
2420 let Self {
2421 mut data,
2422
2423 } = slot_;
2424 }
2425
2426 let _field = data.as_mut();
2427 ::fidl_next::Constrained::validate(_field, (4294967295, ()))?;
2428 ::fidl_next::Decode::decode(data.as_mut(), decoder_, (4294967295, ()))?;
2429
2430 Ok(())
2431 }
2432 }
2433
2434 impl<'de> ::fidl_next::IntoNatural for DeviceReadResponse<'de> {
2435 type Natural = crate::natural::DeviceReadResponse;
2436 }
2437
2438 #[derive(Debug)]
2440 #[repr(C)]
2441 pub struct DeviceWriteRequest<'de> {
2442 pub data: ::fidl_next::wire::Vector<'de, u8>,
2443 }
2444
2445 static_assertions::const_assert_eq!(std::mem::size_of::<DeviceWriteRequest<'_>>(), 16);
2446 static_assertions::const_assert_eq!(std::mem::align_of::<DeviceWriteRequest<'_>>(), 8);
2447
2448 static_assertions::const_assert_eq!(std::mem::offset_of!(DeviceWriteRequest<'_>, data), 0);
2449
2450 impl ::fidl_next::Constrained for DeviceWriteRequest<'_> {
2451 type Constraint = ();
2452
2453 fn validate(
2454 _: ::fidl_next::Slot<'_, Self>,
2455 _: Self::Constraint,
2456 ) -> Result<(), ::fidl_next::ValidationError> {
2457 Ok(())
2458 }
2459 }
2460
2461 unsafe impl ::fidl_next::Wire for DeviceWriteRequest<'static> {
2462 type Narrowed<'de> = DeviceWriteRequest<'de>;
2463
2464 #[inline]
2465 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
2466 ::fidl_next::munge! {
2467 let Self {
2468 data,
2469
2470 } = &mut *out_;
2471 }
2472
2473 ::fidl_next::Wire::zero_padding(data);
2474 }
2475 }
2476
2477 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for DeviceWriteRequest<'de>
2478 where
2479 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
2480 ___D: ::fidl_next::Decoder<'de>,
2481 {
2482 fn decode(
2483 slot_: ::fidl_next::Slot<'_, Self>,
2484 decoder_: &mut ___D,
2485 _: (),
2486 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2487 ::fidl_next::munge! {
2488 let Self {
2489 mut data,
2490
2491 } = slot_;
2492 }
2493
2494 let _field = data.as_mut();
2495 ::fidl_next::Constrained::validate(_field, (4294967295, ()))?;
2496 ::fidl_next::Decode::decode(data.as_mut(), decoder_, (4294967295, ()))?;
2497
2498 Ok(())
2499 }
2500 }
2501
2502 impl<'de> ::fidl_next::IntoNatural for DeviceWriteRequest<'de> {
2503 type Natural = crate::natural::DeviceWriteRequest;
2504 }
2505
2506 pub type DeviceWriteResponse = ::fidl_next::wire::Unit;
2508
2509 #[derive(Clone, Debug)]
2511 #[repr(C)]
2512 pub struct SerialPortInfo {
2513 pub serial_class: crate::wire::Class,
2514
2515 pub serial_vid: ::fidl_next::wire::Uint32,
2516
2517 pub serial_pid: ::fidl_next::wire::Uint32,
2518 }
2519
2520 static_assertions::const_assert_eq!(std::mem::size_of::<SerialPortInfo>(), 12);
2521 static_assertions::const_assert_eq!(std::mem::align_of::<SerialPortInfo>(), 4);
2522
2523 static_assertions::const_assert_eq!(std::mem::offset_of!(SerialPortInfo, serial_class), 0);
2524
2525 static_assertions::const_assert_eq!(std::mem::offset_of!(SerialPortInfo, serial_vid), 4);
2526
2527 static_assertions::const_assert_eq!(std::mem::offset_of!(SerialPortInfo, serial_pid), 8);
2528
2529 impl ::fidl_next::Constrained for SerialPortInfo {
2530 type Constraint = ();
2531
2532 fn validate(
2533 _: ::fidl_next::Slot<'_, Self>,
2534 _: Self::Constraint,
2535 ) -> Result<(), ::fidl_next::ValidationError> {
2536 Ok(())
2537 }
2538 }
2539
2540 unsafe impl ::fidl_next::Wire for SerialPortInfo {
2541 type Narrowed<'de> = SerialPortInfo;
2542
2543 #[inline]
2544 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
2545 ::fidl_next::munge! {
2546 let Self {
2547 serial_class,
2548 serial_vid,
2549 serial_pid,
2550
2551 } = &mut *out_;
2552 }
2553
2554 ::fidl_next::Wire::zero_padding(serial_class);
2555
2556 ::fidl_next::Wire::zero_padding(serial_vid);
2557
2558 ::fidl_next::Wire::zero_padding(serial_pid);
2559
2560 unsafe {
2561 out_.as_mut_ptr().cast::<u8>().add(1).write_bytes(0, 3);
2562 }
2563 }
2564 }
2565
2566 unsafe impl<___D> ::fidl_next::Decode<___D> for SerialPortInfo
2567 where
2568 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
2569 {
2570 fn decode(
2571 slot_: ::fidl_next::Slot<'_, Self>,
2572 decoder_: &mut ___D,
2573 _: (),
2574 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2575 if slot_.as_bytes()[1..4] != [0u8; 3] {
2576 return Err(::fidl_next::DecodeError::InvalidPadding);
2577 }
2578
2579 ::fidl_next::munge! {
2580 let Self {
2581 mut serial_class,
2582 mut serial_vid,
2583 mut serial_pid,
2584
2585 } = slot_;
2586 }
2587
2588 let _field = serial_class.as_mut();
2589
2590 ::fidl_next::Decode::decode(serial_class.as_mut(), decoder_, ())?;
2591
2592 let _field = serial_vid.as_mut();
2593
2594 ::fidl_next::Decode::decode(serial_vid.as_mut(), decoder_, ())?;
2595
2596 let _field = serial_pid.as_mut();
2597
2598 ::fidl_next::Decode::decode(serial_pid.as_mut(), decoder_, ())?;
2599
2600 Ok(())
2601 }
2602 }
2603
2604 impl ::fidl_next::IntoNatural for SerialPortInfo {
2605 type Natural = crate::natural::SerialPortInfo;
2606 }
2607}
2608
2609pub mod wire_optional {}
2610
2611pub mod generic {
2612
2613 pub struct Config<T0, T1, T2, T3, T4> {
2615 pub character_width: T0,
2616
2617 pub stop_width: T1,
2618
2619 pub parity: T2,
2620
2621 pub control_flow: T3,
2622
2623 pub baud_rate: T4,
2624 }
2625
2626 unsafe impl<___E, T0, T1, T2, T3, T4> ::fidl_next::Encode<crate::wire::Config, ___E>
2627 for Config<T0, T1, T2, T3, T4>
2628 where
2629 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2630 T0: ::fidl_next::Encode<crate::wire::CharacterWidth, ___E>,
2631 T1: ::fidl_next::Encode<crate::wire::StopWidth, ___E>,
2632 T2: ::fidl_next::Encode<crate::wire::Parity, ___E>,
2633 T3: ::fidl_next::Encode<crate::wire::FlowControl, ___E>,
2634 T4: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
2635 {
2636 #[inline]
2637 fn encode(
2638 self,
2639 encoder_: &mut ___E,
2640 out_: &mut ::core::mem::MaybeUninit<crate::wire::Config>,
2641 _: (),
2642 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2643 ::fidl_next::munge! {
2644 let crate::wire::Config {
2645 character_width,
2646 stop_width,
2647 parity,
2648 control_flow,
2649 baud_rate,
2650
2651 } = out_;
2652 }
2653
2654 ::fidl_next::Encode::encode(self.character_width, encoder_, character_width, ())?;
2655
2656 ::fidl_next::Encode::encode(self.stop_width, encoder_, stop_width, ())?;
2657
2658 ::fidl_next::Encode::encode(self.parity, encoder_, parity, ())?;
2659
2660 ::fidl_next::Encode::encode(self.control_flow, encoder_, control_flow, ())?;
2661
2662 ::fidl_next::Encode::encode(self.baud_rate, encoder_, baud_rate, ())?;
2663
2664 Ok(())
2665 }
2666 }
2667
2668 unsafe impl<'a, ___E, T0, T1, T2, T3, T4> ::fidl_next::Encode<crate::wire::Config, ___E>
2669 for &'a Config<T0, T1, T2, T3, T4>
2670 where
2671 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2672 &'a T0: ::fidl_next::Encode<crate::wire::CharacterWidth, ___E>,
2673 &'a T1: ::fidl_next::Encode<crate::wire::StopWidth, ___E>,
2674 &'a T2: ::fidl_next::Encode<crate::wire::Parity, ___E>,
2675 &'a T3: ::fidl_next::Encode<crate::wire::FlowControl, ___E>,
2676 &'a T4: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
2677 {
2678 #[inline]
2679 fn encode(
2680 self,
2681 encoder_: &mut ___E,
2682 out_: &mut ::core::mem::MaybeUninit<crate::wire::Config>,
2683 _: (),
2684 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2685 ::fidl_next::munge! {
2686 let crate::wire::Config {
2687 character_width,
2688 stop_width,
2689 parity,
2690 control_flow,
2691 baud_rate,
2692
2693 } = out_;
2694 }
2695
2696 ::fidl_next::Encode::encode(&self.character_width, encoder_, character_width, ())?;
2697
2698 ::fidl_next::Encode::encode(&self.stop_width, encoder_, stop_width, ())?;
2699
2700 ::fidl_next::Encode::encode(&self.parity, encoder_, parity, ())?;
2701
2702 ::fidl_next::Encode::encode(&self.control_flow, encoder_, control_flow, ())?;
2703
2704 ::fidl_next::Encode::encode(&self.baud_rate, encoder_, baud_rate, ())?;
2705
2706 Ok(())
2707 }
2708 }
2709
2710 pub struct DeviceGetClassResponse<T0> {
2712 pub device_class: T0,
2713 }
2714
2715 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceGetClassResponse, ___E>
2716 for DeviceGetClassResponse<T0>
2717 where
2718 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2719 T0: ::fidl_next::Encode<crate::wire::Class, ___E>,
2720 {
2721 #[inline]
2722 fn encode(
2723 self,
2724 encoder_: &mut ___E,
2725 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetClassResponse>,
2726 _: (),
2727 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2728 ::fidl_next::munge! {
2729 let crate::wire::DeviceGetClassResponse {
2730 device_class,
2731
2732 } = out_;
2733 }
2734
2735 ::fidl_next::Encode::encode(self.device_class, encoder_, device_class, ())?;
2736
2737 Ok(())
2738 }
2739 }
2740
2741 unsafe impl<'a, ___E, T0> ::fidl_next::Encode<crate::wire::DeviceGetClassResponse, ___E>
2742 for &'a DeviceGetClassResponse<T0>
2743 where
2744 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2745 &'a T0: ::fidl_next::Encode<crate::wire::Class, ___E>,
2746 {
2747 #[inline]
2748 fn encode(
2749 self,
2750 encoder_: &mut ___E,
2751 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetClassResponse>,
2752 _: (),
2753 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2754 ::fidl_next::munge! {
2755 let crate::wire::DeviceGetClassResponse {
2756 device_class,
2757
2758 } = out_;
2759 }
2760
2761 ::fidl_next::Encode::encode(&self.device_class, encoder_, device_class, ())?;
2762
2763 Ok(())
2764 }
2765 }
2766
2767 pub struct DeviceSetConfigRequest<T0> {
2769 pub config: T0,
2770 }
2771
2772 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceSetConfigRequest, ___E>
2773 for DeviceSetConfigRequest<T0>
2774 where
2775 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2776 T0: ::fidl_next::Encode<crate::wire::Config, ___E>,
2777 {
2778 #[inline]
2779 fn encode(
2780 self,
2781 encoder_: &mut ___E,
2782 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceSetConfigRequest>,
2783 _: (),
2784 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2785 ::fidl_next::munge! {
2786 let crate::wire::DeviceSetConfigRequest {
2787 config,
2788
2789 } = out_;
2790 }
2791
2792 ::fidl_next::Encode::encode(self.config, encoder_, config, ())?;
2793
2794 Ok(())
2795 }
2796 }
2797
2798 unsafe impl<'a, ___E, T0> ::fidl_next::Encode<crate::wire::DeviceSetConfigRequest, ___E>
2799 for &'a DeviceSetConfigRequest<T0>
2800 where
2801 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2802 &'a T0: ::fidl_next::Encode<crate::wire::Config, ___E>,
2803 {
2804 #[inline]
2805 fn encode(
2806 self,
2807 encoder_: &mut ___E,
2808 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceSetConfigRequest>,
2809 _: (),
2810 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2811 ::fidl_next::munge! {
2812 let crate::wire::DeviceSetConfigRequest {
2813 config,
2814
2815 } = out_;
2816 }
2817
2818 ::fidl_next::Encode::encode(&self.config, encoder_, config, ())?;
2819
2820 Ok(())
2821 }
2822 }
2823
2824 pub struct DeviceSetConfigResponse<T0> {
2826 pub s: T0,
2827 }
2828
2829 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceSetConfigResponse, ___E>
2830 for DeviceSetConfigResponse<T0>
2831 where
2832 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2833 T0: ::fidl_next::Encode<::fidl_next::wire::fuchsia::StatusResult, ___E>,
2834 {
2835 #[inline]
2836 fn encode(
2837 self,
2838 encoder_: &mut ___E,
2839 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceSetConfigResponse>,
2840 _: (),
2841 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2842 ::fidl_next::munge! {
2843 let crate::wire::DeviceSetConfigResponse {
2844 s,
2845
2846 } = out_;
2847 }
2848
2849 ::fidl_next::Encode::encode(self.s, encoder_, s, ())?;
2850
2851 Ok(())
2852 }
2853 }
2854
2855 unsafe impl<'a, ___E, T0> ::fidl_next::Encode<crate::wire::DeviceSetConfigResponse, ___E>
2856 for &'a DeviceSetConfigResponse<T0>
2857 where
2858 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2859 &'a T0: ::fidl_next::Encode<::fidl_next::wire::fuchsia::StatusResult, ___E>,
2860 {
2861 #[inline]
2862 fn encode(
2863 self,
2864 encoder_: &mut ___E,
2865 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceSetConfigResponse>,
2866 _: (),
2867 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2868 ::fidl_next::munge! {
2869 let crate::wire::DeviceSetConfigResponse {
2870 s,
2871
2872 } = out_;
2873 }
2874
2875 ::fidl_next::Encode::encode(&self.s, encoder_, s, ())?;
2876
2877 Ok(())
2878 }
2879 }
2880
2881 pub struct DeviceReadResponse<T0> {
2883 pub data: T0,
2884 }
2885
2886 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceReadResponse<'static>, ___E>
2887 for DeviceReadResponse<T0>
2888 where
2889 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2890 ___E: ::fidl_next::Encoder,
2891 T0: ::fidl_next::Encode<::fidl_next::wire::Vector<'static, u8>, ___E>,
2892 {
2893 #[inline]
2894 fn encode(
2895 self,
2896 encoder_: &mut ___E,
2897 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceReadResponse<'static>>,
2898 _: (),
2899 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2900 ::fidl_next::munge! {
2901 let crate::wire::DeviceReadResponse {
2902 data,
2903
2904 } = out_;
2905 }
2906
2907 ::fidl_next::Encode::encode(self.data, encoder_, data, (4294967295, ()))?;
2908
2909 Ok(())
2910 }
2911 }
2912
2913 unsafe impl<'a, ___E, T0> ::fidl_next::Encode<crate::wire::DeviceReadResponse<'static>, ___E>
2914 for &'a DeviceReadResponse<T0>
2915 where
2916 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2917 ___E: ::fidl_next::Encoder,
2918 &'a T0: ::fidl_next::Encode<::fidl_next::wire::Vector<'static, u8>, ___E>,
2919 {
2920 #[inline]
2921 fn encode(
2922 self,
2923 encoder_: &mut ___E,
2924 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceReadResponse<'static>>,
2925 _: (),
2926 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2927 ::fidl_next::munge! {
2928 let crate::wire::DeviceReadResponse {
2929 data,
2930
2931 } = out_;
2932 }
2933
2934 ::fidl_next::Encode::encode(&self.data, encoder_, data, (4294967295, ()))?;
2935
2936 Ok(())
2937 }
2938 }
2939
2940 pub struct DeviceWriteRequest<T0> {
2942 pub data: T0,
2943 }
2944
2945 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceWriteRequest<'static>, ___E>
2946 for DeviceWriteRequest<T0>
2947 where
2948 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2949 ___E: ::fidl_next::Encoder,
2950 T0: ::fidl_next::Encode<::fidl_next::wire::Vector<'static, u8>, ___E>,
2951 {
2952 #[inline]
2953 fn encode(
2954 self,
2955 encoder_: &mut ___E,
2956 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceWriteRequest<'static>>,
2957 _: (),
2958 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2959 ::fidl_next::munge! {
2960 let crate::wire::DeviceWriteRequest {
2961 data,
2962
2963 } = out_;
2964 }
2965
2966 ::fidl_next::Encode::encode(self.data, encoder_, data, (4294967295, ()))?;
2967
2968 Ok(())
2969 }
2970 }
2971
2972 unsafe impl<'a, ___E, T0> ::fidl_next::Encode<crate::wire::DeviceWriteRequest<'static>, ___E>
2973 for &'a DeviceWriteRequest<T0>
2974 where
2975 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2976 ___E: ::fidl_next::Encoder,
2977 &'a T0: ::fidl_next::Encode<::fidl_next::wire::Vector<'static, u8>, ___E>,
2978 {
2979 #[inline]
2980 fn encode(
2981 self,
2982 encoder_: &mut ___E,
2983 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceWriteRequest<'static>>,
2984 _: (),
2985 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2986 ::fidl_next::munge! {
2987 let crate::wire::DeviceWriteRequest {
2988 data,
2989
2990 } = out_;
2991 }
2992
2993 ::fidl_next::Encode::encode(&self.data, encoder_, data, (4294967295, ()))?;
2994
2995 Ok(())
2996 }
2997 }
2998
2999 pub type DeviceWriteResponse = ();
3001
3002 pub struct SerialPortInfo<T0, T1, T2> {
3004 pub serial_class: T0,
3005
3006 pub serial_vid: T1,
3007
3008 pub serial_pid: T2,
3009 }
3010
3011 unsafe impl<___E, T0, T1, T2> ::fidl_next::Encode<crate::wire::SerialPortInfo, ___E>
3012 for SerialPortInfo<T0, T1, T2>
3013 where
3014 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3015 T0: ::fidl_next::Encode<crate::wire::Class, ___E>,
3016 T1: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
3017 T2: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
3018 {
3019 #[inline]
3020 fn encode(
3021 self,
3022 encoder_: &mut ___E,
3023 out_: &mut ::core::mem::MaybeUninit<crate::wire::SerialPortInfo>,
3024 _: (),
3025 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3026 ::fidl_next::munge! {
3027 let crate::wire::SerialPortInfo {
3028 serial_class,
3029 serial_vid,
3030 serial_pid,
3031
3032 } = out_;
3033 }
3034
3035 ::fidl_next::Encode::encode(self.serial_class, encoder_, serial_class, ())?;
3036
3037 ::fidl_next::Encode::encode(self.serial_vid, encoder_, serial_vid, ())?;
3038
3039 ::fidl_next::Encode::encode(self.serial_pid, encoder_, serial_pid, ())?;
3040
3041 Ok(())
3042 }
3043 }
3044
3045 unsafe impl<'a, ___E, T0, T1, T2> ::fidl_next::Encode<crate::wire::SerialPortInfo, ___E>
3046 for &'a SerialPortInfo<T0, T1, T2>
3047 where
3048 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3049 &'a T0: ::fidl_next::Encode<crate::wire::Class, ___E>,
3050 &'a T1: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
3051 &'a T2: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
3052 {
3053 #[inline]
3054 fn encode(
3055 self,
3056 encoder_: &mut ___E,
3057 out_: &mut ::core::mem::MaybeUninit<crate::wire::SerialPortInfo>,
3058 _: (),
3059 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3060 ::fidl_next::munge! {
3061 let crate::wire::SerialPortInfo {
3062 serial_class,
3063 serial_vid,
3064 serial_pid,
3065
3066 } = out_;
3067 }
3068
3069 ::fidl_next::Encode::encode(&self.serial_class, encoder_, serial_class, ())?;
3070
3071 ::fidl_next::Encode::encode(&self.serial_vid, encoder_, serial_vid, ())?;
3072
3073 ::fidl_next::Encode::encode(&self.serial_pid, encoder_, serial_pid, ())?;
3074
3075 Ok(())
3076 }
3077 }
3078}
3079
3080pub use self::natural::*;
3081
3082#[doc = " A serial device.\n"]
3084#[derive(PartialEq, Debug)]
3085pub struct Device;
3086
3087#[cfg(target_os = "fuchsia")]
3088impl ::fidl_next::HasTransport for Device {
3089 type Transport = ::fidl_next::fuchsia::zx::Channel;
3090}
3091
3092pub mod device {
3093 pub mod prelude {
3094 pub use crate::{
3095 Device, DeviceClientHandler, DeviceLocalClientHandler, DeviceLocalServerHandler,
3096 DeviceServerHandler, device,
3097 };
3098
3099 pub use crate::natural::DeviceGetClassResponse;
3100
3101 pub use crate::natural::DeviceSetConfigRequest;
3102
3103 pub use crate::natural::DeviceSetConfigResponse;
3104
3105 pub use crate::natural::DeviceWriteRequest;
3106
3107 pub use crate::natural::DeviceReadResponse;
3108
3109 pub use crate::natural::DeviceWriteResponse;
3110 }
3111
3112 pub struct GetClass;
3113
3114 impl ::fidl_next::Method for GetClass {
3115 const ORDINAL: u64 = 4415985931870841739;
3116 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
3117 ::fidl_next::protocol::Flexibility::Strict;
3118
3119 type Protocol = crate::Device;
3120
3121 type Request = ::fidl_next::wire::EmptyMessageBody;
3122 }
3123
3124 impl ::fidl_next::TwoWayMethod for GetClass {
3125 type Response = ::fidl_next::wire::Strict<crate::wire::DeviceGetClassResponse>;
3126 }
3127
3128 impl<___R> ::fidl_next::Respond<___R> for GetClass {
3129 type Output = ::fidl_next::Strict<crate::generic::DeviceGetClassResponse<___R>>;
3130
3131 fn respond(response: ___R) -> Self::Output {
3132 ::fidl_next::Strict(crate::generic::DeviceGetClassResponse { device_class: response })
3133 }
3134 }
3135
3136 pub struct SetConfig;
3137
3138 impl ::fidl_next::Method for SetConfig {
3139 const ORDINAL: u64 = 8582182240303739251;
3140 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
3141 ::fidl_next::protocol::Flexibility::Strict;
3142
3143 type Protocol = crate::Device;
3144
3145 type Request = crate::wire::DeviceSetConfigRequest;
3146 }
3147
3148 impl ::fidl_next::TwoWayMethod for SetConfig {
3149 type Response = ::fidl_next::wire::Strict<crate::wire::DeviceSetConfigResponse>;
3150 }
3151
3152 impl<___R> ::fidl_next::Respond<___R> for SetConfig {
3153 type Output = ::fidl_next::Strict<crate::generic::DeviceSetConfigResponse<___R>>;
3154
3155 fn respond(response: ___R) -> Self::Output {
3156 ::fidl_next::Strict(crate::generic::DeviceSetConfigResponse { s: response })
3157 }
3158 }
3159
3160 pub struct Read;
3161
3162 impl ::fidl_next::Method for Read {
3163 const ORDINAL: u64 = 7188903048813456856;
3164 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
3165 ::fidl_next::protocol::Flexibility::Strict;
3166
3167 type Protocol = crate::Device;
3168
3169 type Request = ::fidl_next::wire::EmptyMessageBody;
3170 }
3171
3172 impl ::fidl_next::TwoWayMethod for Read {
3173 type Response = ::fidl_next::wire::Result<
3174 'static,
3175 crate::wire::DeviceReadResponse<'static>,
3176 ::fidl_next::wire::fuchsia::Status,
3177 >;
3178 }
3179
3180 impl<___R> ::fidl_next::Respond<___R> for Read {
3181 type Output = ::core::result::Result<
3182 crate::generic::DeviceReadResponse<___R>,
3183 ::fidl_next::never::Never,
3184 >;
3185
3186 fn respond(response: ___R) -> Self::Output {
3187 ::core::result::Result::Ok(crate::generic::DeviceReadResponse { data: response })
3188 }
3189 }
3190
3191 impl<___R> ::fidl_next::RespondErr<___R> for Read {
3192 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
3193
3194 fn respond_err(response: ___R) -> Self::Output {
3195 ::core::result::Result::Err(response)
3196 }
3197 }
3198
3199 pub struct Write;
3200
3201 impl ::fidl_next::Method for Write {
3202 const ORDINAL: u64 = 7685302253716076444;
3203 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
3204 ::fidl_next::protocol::Flexibility::Strict;
3205
3206 type Protocol = crate::Device;
3207
3208 type Request = crate::wire::DeviceWriteRequest<'static>;
3209 }
3210
3211 impl ::fidl_next::TwoWayMethod for Write {
3212 type Response = ::fidl_next::wire::Result<
3213 'static,
3214 crate::wire::DeviceWriteResponse,
3215 ::fidl_next::wire::fuchsia::Status,
3216 >;
3217 }
3218
3219 impl<___R> ::fidl_next::Respond<___R> for Write {
3220 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
3221
3222 fn respond(response: ___R) -> Self::Output {
3223 ::core::result::Result::Ok(response)
3224 }
3225 }
3226
3227 impl<___R> ::fidl_next::RespondErr<___R> for Write {
3228 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
3229
3230 fn respond_err(response: ___R) -> Self::Output {
3231 ::core::result::Result::Err(response)
3232 }
3233 }
3234
3235 mod ___detail {
3236 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Device
3237 where
3238 ___T: ::fidl_next::Transport,
3239 {
3240 type Client = DeviceClient<___T>;
3241 type Server = DeviceServer<___T>;
3242 }
3243
3244 #[repr(transparent)]
3246 pub struct DeviceClient<___T: ::fidl_next::Transport> {
3247 #[allow(dead_code)]
3248 client: ::fidl_next::protocol::Client<___T>,
3249 }
3250
3251 impl<___T> DeviceClient<___T>
3252 where
3253 ___T: ::fidl_next::Transport,
3254 {
3255 #[doc = " Lookup what type of serial device this is.\n"]
3256 pub fn get_class(&self) -> ::fidl_next::TwoWayFuture<'_, super::GetClass, ___T> {
3257 ::fidl_next::TwoWayFuture::from_untyped(
3258 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
3259 4415985931870841739,
3260 <super::GetClass as ::fidl_next::Method>::FLEXIBILITY,
3261 (),
3262 ),
3263 )
3264 }
3265
3266 #[doc = " Set the configuration of this serial device.\n"]
3267 pub fn set_config(
3268 &self,
3269
3270 config: impl ::fidl_next::Encode<
3271 crate::wire::Config,
3272 <___T as ::fidl_next::Transport>::SendBuffer,
3273 >,
3274 ) -> ::fidl_next::TwoWayFuture<'_, super::SetConfig, ___T>
3275 where
3276 <___T as ::fidl_next::Transport>::SendBuffer:
3277 ::fidl_next::encoder::InternalHandleEncoder,
3278 {
3279 self.set_config_with(crate::generic::DeviceSetConfigRequest { config })
3280 }
3281
3282 #[doc = " Set the configuration of this serial device.\n"]
3283 pub fn set_config_with<___R>(
3284 &self,
3285 request: ___R,
3286 ) -> ::fidl_next::TwoWayFuture<'_, super::SetConfig, ___T>
3287 where
3288 ___R: ::fidl_next::Encode<
3289 crate::wire::DeviceSetConfigRequest,
3290 <___T as ::fidl_next::Transport>::SendBuffer,
3291 >,
3292 {
3293 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
3294 8582182240303739251,
3295 <super::SetConfig as ::fidl_next::Method>::FLEXIBILITY,
3296 request,
3297 ))
3298 }
3299
3300 #[doc = " Reads data from the serial port.\n"]
3301 pub fn read(&self) -> ::fidl_next::TwoWayFuture<'_, super::Read, ___T> {
3302 ::fidl_next::TwoWayFuture::from_untyped(
3303 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
3304 7188903048813456856,
3305 <super::Read as ::fidl_next::Method>::FLEXIBILITY,
3306 (),
3307 ),
3308 )
3309 }
3310
3311 #[doc = " Writes data to the serial port.\n"]
3312 pub fn write(
3313 &self,
3314
3315 data: impl ::fidl_next::Encode<
3316 ::fidl_next::wire::Vector<'static, u8>,
3317 <___T as ::fidl_next::Transport>::SendBuffer,
3318 >,
3319 ) -> ::fidl_next::TwoWayFuture<'_, super::Write, ___T>
3320 where
3321 <___T as ::fidl_next::Transport>::SendBuffer:
3322 ::fidl_next::encoder::InternalHandleEncoder,
3323 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
3324 {
3325 self.write_with(crate::generic::DeviceWriteRequest { data })
3326 }
3327
3328 #[doc = " Writes data to the serial port.\n"]
3329 pub fn write_with<___R>(
3330 &self,
3331 request: ___R,
3332 ) -> ::fidl_next::TwoWayFuture<'_, super::Write, ___T>
3333 where
3334 ___R: ::fidl_next::Encode<
3335 crate::wire::DeviceWriteRequest<'static>,
3336 <___T as ::fidl_next::Transport>::SendBuffer,
3337 >,
3338 {
3339 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
3340 7685302253716076444,
3341 <super::Write as ::fidl_next::Method>::FLEXIBILITY,
3342 request,
3343 ))
3344 }
3345 }
3346
3347 #[repr(transparent)]
3349 pub struct DeviceServer<___T: ::fidl_next::Transport> {
3350 server: ::fidl_next::protocol::Server<___T>,
3351 }
3352
3353 impl<___T> DeviceServer<___T> where ___T: ::fidl_next::Transport {}
3354 }
3355}
3356
3357#[diagnostic::on_unimplemented(
3358 note = "If {Self} implements the non-local DeviceClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
3359)]
3360
3361pub trait DeviceLocalClientHandler<
3365 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
3366 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
3367>
3368{
3369}
3370
3371impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Device
3372where
3373 ___H: DeviceLocalClientHandler<___T>,
3374 ___T: ::fidl_next::Transport,
3375{
3376 async fn on_event(
3377 handler: &mut ___H,
3378 mut message: ::fidl_next::Message<___T>,
3379 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
3380 match *message.header().ordinal {
3381 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
3382 }
3383 }
3384}
3385
3386#[diagnostic::on_unimplemented(
3387 note = "If {Self} implements the non-local DeviceServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
3388)]
3389
3390pub trait DeviceLocalServerHandler<
3394 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
3395 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
3396>
3397{
3398 #[doc = " Lookup what type of serial device this is.\n"]
3399 fn get_class(
3400 &mut self,
3401
3402 responder: ::fidl_next::Responder<device::GetClass, ___T>,
3403 ) -> impl ::core::future::Future<Output = ()>;
3404
3405 #[doc = " Set the configuration of this serial device.\n"]
3406 fn set_config(
3407 &mut self,
3408
3409 request: ::fidl_next::Request<device::SetConfig, ___T>,
3410
3411 responder: ::fidl_next::Responder<device::SetConfig, ___T>,
3412 ) -> impl ::core::future::Future<Output = ()>;
3413
3414 #[doc = " Reads data from the serial port.\n"]
3415 fn read(
3416 &mut self,
3417
3418 responder: ::fidl_next::Responder<device::Read, ___T>,
3419 ) -> impl ::core::future::Future<Output = ()>;
3420
3421 #[doc = " Writes data to the serial port.\n"]
3422 fn write(
3423 &mut self,
3424
3425 request: ::fidl_next::Request<device::Write, ___T>,
3426
3427 responder: ::fidl_next::Responder<device::Write, ___T>,
3428 ) -> impl ::core::future::Future<Output = ()>;
3429}
3430
3431impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Device
3432where
3433 ___H: DeviceLocalServerHandler<___T>,
3434 ___T: ::fidl_next::Transport,
3435 for<'de> crate::wire::DeviceSetConfigRequest: ::fidl_next::Decode<
3436 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3437 Constraint = (),
3438 >,
3439 for<'de> crate::wire::DeviceWriteRequest<'de>: ::fidl_next::Decode<
3440 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3441 Constraint = (),
3442 >,
3443{
3444 async fn on_one_way(
3445 handler: &mut ___H,
3446 mut message: ::fidl_next::Message<___T>,
3447 ) -> ::core::result::Result<
3448 (),
3449 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
3450 > {
3451 match *message.header().ordinal {
3452 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
3453 }
3454 }
3455
3456 async fn on_two_way(
3457 handler: &mut ___H,
3458 mut message: ::fidl_next::Message<___T>,
3459 responder: ::fidl_next::protocol::Responder<___T>,
3460 ) -> ::core::result::Result<
3461 (),
3462 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
3463 > {
3464 match *message.header().ordinal {
3465 4415985931870841739 => {
3466 let responder = ::fidl_next::Responder::from_untyped(responder);
3467
3468 handler.get_class(responder).await;
3469 Ok(())
3470 }
3471
3472 8582182240303739251 => {
3473 let responder = ::fidl_next::Responder::from_untyped(responder);
3474
3475 match ::fidl_next::AsDecoderExt::into_decoded(message) {
3476 Ok(decoded) => {
3477 handler
3478 .set_config(::fidl_next::Request::from_decoded(decoded), responder)
3479 .await;
3480 Ok(())
3481 }
3482 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3483 ordinal: 8582182240303739251,
3484 error,
3485 }),
3486 }
3487 }
3488
3489 7188903048813456856 => {
3490 let responder = ::fidl_next::Responder::from_untyped(responder);
3491
3492 handler.read(responder).await;
3493 Ok(())
3494 }
3495
3496 7685302253716076444 => {
3497 let responder = ::fidl_next::Responder::from_untyped(responder);
3498
3499 match ::fidl_next::AsDecoderExt::into_decoded(message) {
3500 Ok(decoded) => {
3501 handler.write(::fidl_next::Request::from_decoded(decoded), responder).await;
3502 Ok(())
3503 }
3504 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3505 ordinal: 7685302253716076444,
3506 error,
3507 }),
3508 }
3509 }
3510
3511 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
3512 }
3513 }
3514}
3515
3516pub trait DeviceClientHandler<
3520 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
3521 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
3522>
3523{
3524}
3525
3526impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Device
3527where
3528 ___H: DeviceClientHandler<___T> + ::core::marker::Send,
3529 ___T: ::fidl_next::Transport,
3530{
3531 async fn on_event(
3532 handler: &mut ___H,
3533 mut message: ::fidl_next::Message<___T>,
3534 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
3535 match *message.header().ordinal {
3536 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
3537 }
3538 }
3539}
3540
3541pub trait DeviceServerHandler<
3545 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
3546 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
3547>
3548{
3549 #[doc = " Lookup what type of serial device this is.\n"]
3550 fn get_class(
3551 &mut self,
3552
3553 responder: ::fidl_next::Responder<device::GetClass, ___T>,
3554 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
3555
3556 #[doc = " Set the configuration of this serial device.\n"]
3557 fn set_config(
3558 &mut self,
3559
3560 request: ::fidl_next::Request<device::SetConfig, ___T>,
3561
3562 responder: ::fidl_next::Responder<device::SetConfig, ___T>,
3563 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
3564
3565 #[doc = " Reads data from the serial port.\n"]
3566 fn read(
3567 &mut self,
3568
3569 responder: ::fidl_next::Responder<device::Read, ___T>,
3570 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
3571
3572 #[doc = " Writes data to the serial port.\n"]
3573 fn write(
3574 &mut self,
3575
3576 request: ::fidl_next::Request<device::Write, ___T>,
3577
3578 responder: ::fidl_next::Responder<device::Write, ___T>,
3579 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
3580}
3581
3582impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Device
3583where
3584 ___H: DeviceServerHandler<___T> + ::core::marker::Send,
3585 ___T: ::fidl_next::Transport,
3586 for<'de> crate::wire::DeviceSetConfigRequest: ::fidl_next::Decode<
3587 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3588 Constraint = (),
3589 >,
3590 for<'de> crate::wire::DeviceWriteRequest<'de>: ::fidl_next::Decode<
3591 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
3592 Constraint = (),
3593 >,
3594{
3595 async fn on_one_way(
3596 handler: &mut ___H,
3597 mut message: ::fidl_next::Message<___T>,
3598 ) -> ::core::result::Result<
3599 (),
3600 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
3601 > {
3602 match *message.header().ordinal {
3603 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
3604 }
3605 }
3606
3607 async fn on_two_way(
3608 handler: &mut ___H,
3609 mut message: ::fidl_next::Message<___T>,
3610 responder: ::fidl_next::protocol::Responder<___T>,
3611 ) -> ::core::result::Result<
3612 (),
3613 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
3614 > {
3615 match *message.header().ordinal {
3616 4415985931870841739 => {
3617 let responder = ::fidl_next::Responder::from_untyped(responder);
3618
3619 handler.get_class(responder).await;
3620 Ok(())
3621 }
3622
3623 8582182240303739251 => {
3624 let responder = ::fidl_next::Responder::from_untyped(responder);
3625
3626 match ::fidl_next::AsDecoderExt::into_decoded(message) {
3627 Ok(decoded) => {
3628 handler
3629 .set_config(::fidl_next::Request::from_decoded(decoded), responder)
3630 .await;
3631 Ok(())
3632 }
3633 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3634 ordinal: 8582182240303739251,
3635 error,
3636 }),
3637 }
3638 }
3639
3640 7188903048813456856 => {
3641 let responder = ::fidl_next::Responder::from_untyped(responder);
3642
3643 handler.read(responder).await;
3644 Ok(())
3645 }
3646
3647 7685302253716076444 => {
3648 let responder = ::fidl_next::Responder::from_untyped(responder);
3649
3650 match ::fidl_next::AsDecoderExt::into_decoded(message) {
3651 Ok(decoded) => {
3652 handler.write(::fidl_next::Request::from_decoded(decoded), responder).await;
3653 Ok(())
3654 }
3655 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
3656 ordinal: 7685302253716076444,
3657 error,
3658 }),
3659 }
3660 }
3661
3662 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
3663 }
3664 }
3665}
3666
3667impl<___T> DeviceClientHandler<___T> for ::fidl_next::IgnoreEvents where ___T: ::fidl_next::Transport
3668{}
3669
3670impl<___H, ___T> DeviceLocalClientHandler<___T> for ::fidl_next::Local<___H>
3671where
3672 ___H: DeviceClientHandler<___T>,
3673 ___T: ::fidl_next::Transport,
3674{
3675}
3676
3677impl<___H, ___T> DeviceLocalServerHandler<___T> for ::fidl_next::Local<___H>
3678where
3679 ___H: DeviceServerHandler<___T>,
3680 ___T: ::fidl_next::Transport,
3681{
3682 async fn get_class(&mut self, responder: ::fidl_next::Responder<device::GetClass, ___T>) {
3683 ___H::get_class(&mut self.0, responder).await
3684 }
3685
3686 async fn set_config(
3687 &mut self,
3688
3689 request: ::fidl_next::Request<device::SetConfig, ___T>,
3690
3691 responder: ::fidl_next::Responder<device::SetConfig, ___T>,
3692 ) {
3693 ___H::set_config(&mut self.0, request, responder).await
3694 }
3695
3696 async fn read(&mut self, responder: ::fidl_next::Responder<device::Read, ___T>) {
3697 ___H::read(&mut self.0, responder).await
3698 }
3699
3700 async fn write(
3701 &mut self,
3702
3703 request: ::fidl_next::Request<device::Write, ___T>,
3704
3705 responder: ::fidl_next::Responder<device::Write, ___T>,
3706 ) {
3707 ___H::write(&mut self.0, request, responder).await
3708 }
3709}