1#![warn(clippy::all)]
3#![allow(unused_parens, unused_variables, unused_mut, unused_imports, unreachable_code)]
4
5pub mod natural {
6
7 #[derive(Debug, Clone, PartialEq)]
8 pub struct DeviceGetInfoResponse {
9 pub info: ::fidl_next_common_fuchsia_hardware_serial::natural::SerialPortInfo,
10 }
11
12 unsafe impl<___E> ::fidl_next::Encode<crate::wire::DeviceGetInfoResponse, ___E>
13 for DeviceGetInfoResponse
14 where
15 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
16 {
17 #[inline]
18 fn encode(
19 self,
20 encoder_: &mut ___E,
21 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetInfoResponse>,
22 _: (),
23 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
24 ::fidl_next::munge! {
25 let crate::wire::DeviceGetInfoResponse {
26 info,
27
28 } = out_;
29 }
30
31 ::fidl_next::Encode::encode(self.info, encoder_, info, ())?;
32
33 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(info.as_mut_ptr()) };
34
35 Ok(())
36 }
37 }
38
39 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DeviceGetInfoResponse, ___E>
40 for &'a DeviceGetInfoResponse
41 where
42 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
43 {
44 #[inline]
45 fn encode(
46 self,
47 encoder_: &mut ___E,
48 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetInfoResponse>,
49 _: (),
50 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
51 ::fidl_next::munge! {
52 let crate::wire::DeviceGetInfoResponse {
53 info,
54
55 } = out_;
56 }
57
58 ::fidl_next::Encode::encode(&self.info, encoder_, info, ())?;
59
60 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(info.as_mut_ptr()) };
61
62 Ok(())
63 }
64 }
65
66 unsafe impl<___E>
67 ::fidl_next::EncodeOption<
68 ::fidl_next::wire::Box<'static, crate::wire::DeviceGetInfoResponse>,
69 ___E,
70 > for DeviceGetInfoResponse
71 where
72 ___E: ::fidl_next::Encoder + ?Sized,
73 DeviceGetInfoResponse: ::fidl_next::Encode<crate::wire::DeviceGetInfoResponse, ___E>,
74 {
75 #[inline]
76 fn encode_option(
77 this: ::core::option::Option<Self>,
78 encoder: &mut ___E,
79 out: &mut ::core::mem::MaybeUninit<
80 ::fidl_next::wire::Box<'static, crate::wire::DeviceGetInfoResponse>,
81 >,
82 _: (),
83 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
84 if let Some(inner) = this {
85 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
86 ::fidl_next::wire::Box::encode_present(out);
87 } else {
88 ::fidl_next::wire::Box::encode_absent(out);
89 }
90
91 Ok(())
92 }
93 }
94
95 unsafe impl<'a, ___E>
96 ::fidl_next::EncodeOption<
97 ::fidl_next::wire::Box<'static, crate::wire::DeviceGetInfoResponse>,
98 ___E,
99 > for &'a DeviceGetInfoResponse
100 where
101 ___E: ::fidl_next::Encoder + ?Sized,
102 &'a DeviceGetInfoResponse: ::fidl_next::Encode<crate::wire::DeviceGetInfoResponse, ___E>,
103 {
104 #[inline]
105 fn encode_option(
106 this: ::core::option::Option<Self>,
107 encoder: &mut ___E,
108 out: &mut ::core::mem::MaybeUninit<
109 ::fidl_next::wire::Box<'static, crate::wire::DeviceGetInfoResponse>,
110 >,
111 _: (),
112 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
113 if let Some(inner) = this {
114 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
115 ::fidl_next::wire::Box::encode_present(out);
116 } else {
117 ::fidl_next::wire::Box::encode_absent(out);
118 }
119
120 Ok(())
121 }
122 }
123
124 impl ::fidl_next::FromWire<crate::wire::DeviceGetInfoResponse> for DeviceGetInfoResponse {
125 #[inline]
126 fn from_wire(wire: crate::wire::DeviceGetInfoResponse) -> Self {
127 Self { info: ::fidl_next::FromWire::from_wire(wire.info) }
128 }
129 }
130
131 impl ::fidl_next::FromWireRef<crate::wire::DeviceGetInfoResponse> for DeviceGetInfoResponse {
132 #[inline]
133 fn from_wire_ref(wire: &crate::wire::DeviceGetInfoResponse) -> Self {
134 Self { info: ::fidl_next::FromWireRef::from_wire_ref(&wire.info) }
135 }
136 }
137
138 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
139 #[repr(C)]
140 pub struct DeviceConfigRequest {
141 pub baud_rate: u32,
142
143 pub flags: u32,
144 }
145
146 unsafe impl<___E> ::fidl_next::Encode<crate::wire::DeviceConfigRequest, ___E>
147 for DeviceConfigRequest
148 where
149 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
150 {
151 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
152 Self,
153 crate::wire::DeviceConfigRequest,
154 > = unsafe {
155 ::fidl_next::CopyOptimization::enable_if(
156 true
157
158 && <
159 u32 as ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>
160 >::COPY_OPTIMIZATION.is_enabled()
161
162 && <
163 u32 as ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>
164 >::COPY_OPTIMIZATION.is_enabled()
165
166 )
167 };
168
169 #[inline]
170 fn encode(
171 self,
172 encoder_: &mut ___E,
173 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceConfigRequest>,
174 _: (),
175 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
176 ::fidl_next::munge! {
177 let crate::wire::DeviceConfigRequest {
178 baud_rate,
179 flags,
180
181 } = out_;
182 }
183
184 ::fidl_next::Encode::encode(self.baud_rate, encoder_, baud_rate, ())?;
185
186 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(baud_rate.as_mut_ptr()) };
187
188 ::fidl_next::Encode::encode(self.flags, encoder_, flags, ())?;
189
190 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(flags.as_mut_ptr()) };
191
192 Ok(())
193 }
194 }
195
196 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DeviceConfigRequest, ___E>
197 for &'a DeviceConfigRequest
198 where
199 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
200 {
201 #[inline]
202 fn encode(
203 self,
204 encoder_: &mut ___E,
205 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceConfigRequest>,
206 _: (),
207 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
208 ::fidl_next::munge! {
209 let crate::wire::DeviceConfigRequest {
210 baud_rate,
211 flags,
212
213 } = out_;
214 }
215
216 ::fidl_next::Encode::encode(&self.baud_rate, encoder_, baud_rate, ())?;
217
218 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(baud_rate.as_mut_ptr()) };
219
220 ::fidl_next::Encode::encode(&self.flags, encoder_, flags, ())?;
221
222 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(flags.as_mut_ptr()) };
223
224 Ok(())
225 }
226 }
227
228 unsafe impl<___E>
229 ::fidl_next::EncodeOption<
230 ::fidl_next::wire::Box<'static, crate::wire::DeviceConfigRequest>,
231 ___E,
232 > for DeviceConfigRequest
233 where
234 ___E: ::fidl_next::Encoder + ?Sized,
235 DeviceConfigRequest: ::fidl_next::Encode<crate::wire::DeviceConfigRequest, ___E>,
236 {
237 #[inline]
238 fn encode_option(
239 this: ::core::option::Option<Self>,
240 encoder: &mut ___E,
241 out: &mut ::core::mem::MaybeUninit<
242 ::fidl_next::wire::Box<'static, crate::wire::DeviceConfigRequest>,
243 >,
244 _: (),
245 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
246 if let Some(inner) = this {
247 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
248 ::fidl_next::wire::Box::encode_present(out);
249 } else {
250 ::fidl_next::wire::Box::encode_absent(out);
251 }
252
253 Ok(())
254 }
255 }
256
257 unsafe impl<'a, ___E>
258 ::fidl_next::EncodeOption<
259 ::fidl_next::wire::Box<'static, crate::wire::DeviceConfigRequest>,
260 ___E,
261 > for &'a DeviceConfigRequest
262 where
263 ___E: ::fidl_next::Encoder + ?Sized,
264 &'a DeviceConfigRequest: ::fidl_next::Encode<crate::wire::DeviceConfigRequest, ___E>,
265 {
266 #[inline]
267 fn encode_option(
268 this: ::core::option::Option<Self>,
269 encoder: &mut ___E,
270 out: &mut ::core::mem::MaybeUninit<
271 ::fidl_next::wire::Box<'static, crate::wire::DeviceConfigRequest>,
272 >,
273 _: (),
274 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
275 if let Some(inner) = this {
276 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
277 ::fidl_next::wire::Box::encode_present(out);
278 } else {
279 ::fidl_next::wire::Box::encode_absent(out);
280 }
281
282 Ok(())
283 }
284 }
285
286 impl ::fidl_next::FromWire<crate::wire::DeviceConfigRequest> for DeviceConfigRequest {
287 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
288 crate::wire::DeviceConfigRequest,
289 Self,
290 > = unsafe {
291 ::fidl_next::CopyOptimization::enable_if(
292 true
293 && <u32 as ::fidl_next::FromWire<::fidl_next::wire::Uint32>>::COPY_OPTIMIZATION
294 .is_enabled()
295 && <u32 as ::fidl_next::FromWire<::fidl_next::wire::Uint32>>::COPY_OPTIMIZATION
296 .is_enabled(),
297 )
298 };
299
300 #[inline]
301 fn from_wire(wire: crate::wire::DeviceConfigRequest) -> Self {
302 Self {
303 baud_rate: ::fidl_next::FromWire::from_wire(wire.baud_rate),
304
305 flags: ::fidl_next::FromWire::from_wire(wire.flags),
306 }
307 }
308 }
309
310 impl ::fidl_next::FromWireRef<crate::wire::DeviceConfigRequest> for DeviceConfigRequest {
311 #[inline]
312 fn from_wire_ref(wire: &crate::wire::DeviceConfigRequest) -> Self {
313 Self {
314 baud_rate: ::fidl_next::FromWireRef::from_wire_ref(&wire.baud_rate),
315
316 flags: ::fidl_next::FromWireRef::from_wire_ref(&wire.flags),
317 }
318 }
319 }
320
321 pub type DeviceConfigResponse = ();
322
323 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
324 #[repr(C)]
325 pub struct DeviceEnableRequest {
326 pub enable: bool,
327 }
328
329 unsafe impl<___E> ::fidl_next::Encode<crate::wire::DeviceEnableRequest, ___E>
330 for DeviceEnableRequest
331 where
332 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
333 {
334 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
335 Self,
336 crate::wire::DeviceEnableRequest,
337 > = unsafe {
338 ::fidl_next::CopyOptimization::enable_if(
339 true && <bool as ::fidl_next::Encode<bool, ___E>>::COPY_OPTIMIZATION.is_enabled(),
340 )
341 };
342
343 #[inline]
344 fn encode(
345 self,
346 encoder_: &mut ___E,
347 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceEnableRequest>,
348 _: (),
349 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
350 ::fidl_next::munge! {
351 let crate::wire::DeviceEnableRequest {
352 enable,
353
354 } = out_;
355 }
356
357 ::fidl_next::Encode::encode(self.enable, encoder_, enable, ())?;
358
359 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(enable.as_mut_ptr()) };
360
361 Ok(())
362 }
363 }
364
365 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DeviceEnableRequest, ___E>
366 for &'a DeviceEnableRequest
367 where
368 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
369 {
370 #[inline]
371 fn encode(
372 self,
373 encoder_: &mut ___E,
374 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceEnableRequest>,
375 _: (),
376 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
377 ::fidl_next::munge! {
378 let crate::wire::DeviceEnableRequest {
379 enable,
380
381 } = out_;
382 }
383
384 ::fidl_next::Encode::encode(&self.enable, encoder_, enable, ())?;
385
386 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(enable.as_mut_ptr()) };
387
388 Ok(())
389 }
390 }
391
392 unsafe impl<___E>
393 ::fidl_next::EncodeOption<
394 ::fidl_next::wire::Box<'static, crate::wire::DeviceEnableRequest>,
395 ___E,
396 > for DeviceEnableRequest
397 where
398 ___E: ::fidl_next::Encoder + ?Sized,
399 DeviceEnableRequest: ::fidl_next::Encode<crate::wire::DeviceEnableRequest, ___E>,
400 {
401 #[inline]
402 fn encode_option(
403 this: ::core::option::Option<Self>,
404 encoder: &mut ___E,
405 out: &mut ::core::mem::MaybeUninit<
406 ::fidl_next::wire::Box<'static, crate::wire::DeviceEnableRequest>,
407 >,
408 _: (),
409 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
410 if let Some(inner) = this {
411 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
412 ::fidl_next::wire::Box::encode_present(out);
413 } else {
414 ::fidl_next::wire::Box::encode_absent(out);
415 }
416
417 Ok(())
418 }
419 }
420
421 unsafe impl<'a, ___E>
422 ::fidl_next::EncodeOption<
423 ::fidl_next::wire::Box<'static, crate::wire::DeviceEnableRequest>,
424 ___E,
425 > for &'a DeviceEnableRequest
426 where
427 ___E: ::fidl_next::Encoder + ?Sized,
428 &'a DeviceEnableRequest: ::fidl_next::Encode<crate::wire::DeviceEnableRequest, ___E>,
429 {
430 #[inline]
431 fn encode_option(
432 this: ::core::option::Option<Self>,
433 encoder: &mut ___E,
434 out: &mut ::core::mem::MaybeUninit<
435 ::fidl_next::wire::Box<'static, crate::wire::DeviceEnableRequest>,
436 >,
437 _: (),
438 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
439 if let Some(inner) = this {
440 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
441 ::fidl_next::wire::Box::encode_present(out);
442 } else {
443 ::fidl_next::wire::Box::encode_absent(out);
444 }
445
446 Ok(())
447 }
448 }
449
450 impl ::fidl_next::FromWire<crate::wire::DeviceEnableRequest> for DeviceEnableRequest {
451 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
452 crate::wire::DeviceEnableRequest,
453 Self,
454 > = unsafe {
455 ::fidl_next::CopyOptimization::enable_if(
456 true && <bool as ::fidl_next::FromWire<bool>>::COPY_OPTIMIZATION.is_enabled(),
457 )
458 };
459
460 #[inline]
461 fn from_wire(wire: crate::wire::DeviceEnableRequest) -> Self {
462 Self { enable: ::fidl_next::FromWire::from_wire(wire.enable) }
463 }
464 }
465
466 impl ::fidl_next::FromWireRef<crate::wire::DeviceEnableRequest> for DeviceEnableRequest {
467 #[inline]
468 fn from_wire_ref(wire: &crate::wire::DeviceEnableRequest) -> Self {
469 Self { enable: ::fidl_next::FromWireRef::from_wire_ref(&wire.enable) }
470 }
471 }
472
473 pub type DeviceEnableResponse = ();
474
475 #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
476 pub struct DeviceReadResponse {
477 pub data: ::std::vec::Vec<u8>,
478 }
479
480 unsafe impl<___E> ::fidl_next::Encode<crate::wire::DeviceReadResponse<'static>, ___E>
481 for DeviceReadResponse
482 where
483 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
484 ___E: ::fidl_next::Encoder,
485 {
486 #[inline]
487 fn encode(
488 self,
489 encoder_: &mut ___E,
490 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceReadResponse<'static>>,
491 _: (),
492 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
493 ::fidl_next::munge! {
494 let crate::wire::DeviceReadResponse {
495 data,
496
497 } = out_;
498 }
499
500 ::fidl_next::Encode::encode(self.data, encoder_, data, (4294967295, ()))?;
501
502 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(data.as_mut_ptr()) };
503 ::fidl_next::Constrained::validate(_field, (4294967295, ()))?;
504
505 Ok(())
506 }
507 }
508
509 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DeviceReadResponse<'static>, ___E>
510 for &'a DeviceReadResponse
511 where
512 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
513 ___E: ::fidl_next::Encoder,
514 {
515 #[inline]
516 fn encode(
517 self,
518 encoder_: &mut ___E,
519 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceReadResponse<'static>>,
520 _: (),
521 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
522 ::fidl_next::munge! {
523 let crate::wire::DeviceReadResponse {
524 data,
525
526 } = out_;
527 }
528
529 ::fidl_next::Encode::encode(&self.data, encoder_, data, (4294967295, ()))?;
530
531 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(data.as_mut_ptr()) };
532 ::fidl_next::Constrained::validate(_field, (4294967295, ()))?;
533
534 Ok(())
535 }
536 }
537
538 unsafe impl<___E>
539 ::fidl_next::EncodeOption<
540 ::fidl_next::wire::Box<'static, crate::wire::DeviceReadResponse<'static>>,
541 ___E,
542 > for DeviceReadResponse
543 where
544 ___E: ::fidl_next::Encoder + ?Sized,
545 DeviceReadResponse: ::fidl_next::Encode<crate::wire::DeviceReadResponse<'static>, ___E>,
546 {
547 #[inline]
548 fn encode_option(
549 this: ::core::option::Option<Self>,
550 encoder: &mut ___E,
551 out: &mut ::core::mem::MaybeUninit<
552 ::fidl_next::wire::Box<'static, crate::wire::DeviceReadResponse<'static>>,
553 >,
554 _: (),
555 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
556 if let Some(inner) = this {
557 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
558 ::fidl_next::wire::Box::encode_present(out);
559 } else {
560 ::fidl_next::wire::Box::encode_absent(out);
561 }
562
563 Ok(())
564 }
565 }
566
567 unsafe impl<'a, ___E>
568 ::fidl_next::EncodeOption<
569 ::fidl_next::wire::Box<'static, crate::wire::DeviceReadResponse<'static>>,
570 ___E,
571 > for &'a DeviceReadResponse
572 where
573 ___E: ::fidl_next::Encoder + ?Sized,
574 &'a DeviceReadResponse: ::fidl_next::Encode<crate::wire::DeviceReadResponse<'static>, ___E>,
575 {
576 #[inline]
577 fn encode_option(
578 this: ::core::option::Option<Self>,
579 encoder: &mut ___E,
580 out: &mut ::core::mem::MaybeUninit<
581 ::fidl_next::wire::Box<'static, crate::wire::DeviceReadResponse<'static>>,
582 >,
583 _: (),
584 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
585 if let Some(inner) = this {
586 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
587 ::fidl_next::wire::Box::encode_present(out);
588 } else {
589 ::fidl_next::wire::Box::encode_absent(out);
590 }
591
592 Ok(())
593 }
594 }
595
596 impl<'de> ::fidl_next::FromWire<crate::wire::DeviceReadResponse<'de>> for DeviceReadResponse {
597 #[inline]
598 fn from_wire(wire: crate::wire::DeviceReadResponse<'de>) -> Self {
599 Self { data: ::fidl_next::FromWire::from_wire(wire.data) }
600 }
601 }
602
603 impl<'de> ::fidl_next::FromWireRef<crate::wire::DeviceReadResponse<'de>> for DeviceReadResponse {
604 #[inline]
605 fn from_wire_ref(wire: &crate::wire::DeviceReadResponse<'de>) -> Self {
606 Self { data: ::fidl_next::FromWireRef::from_wire_ref(&wire.data) }
607 }
608 }
609
610 #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
611 pub struct DeviceWriteRequest {
612 pub data: ::std::vec::Vec<u8>,
613 }
614
615 unsafe impl<___E> ::fidl_next::Encode<crate::wire::DeviceWriteRequest<'static>, ___E>
616 for DeviceWriteRequest
617 where
618 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
619 ___E: ::fidl_next::Encoder,
620 {
621 #[inline]
622 fn encode(
623 self,
624 encoder_: &mut ___E,
625 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceWriteRequest<'static>>,
626 _: (),
627 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
628 ::fidl_next::munge! {
629 let crate::wire::DeviceWriteRequest {
630 data,
631
632 } = out_;
633 }
634
635 ::fidl_next::Encode::encode(self.data, encoder_, data, (4294967295, ()))?;
636
637 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(data.as_mut_ptr()) };
638 ::fidl_next::Constrained::validate(_field, (4294967295, ()))?;
639
640 Ok(())
641 }
642 }
643
644 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DeviceWriteRequest<'static>, ___E>
645 for &'a DeviceWriteRequest
646 where
647 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
648 ___E: ::fidl_next::Encoder,
649 {
650 #[inline]
651 fn encode(
652 self,
653 encoder_: &mut ___E,
654 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceWriteRequest<'static>>,
655 _: (),
656 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
657 ::fidl_next::munge! {
658 let crate::wire::DeviceWriteRequest {
659 data,
660
661 } = out_;
662 }
663
664 ::fidl_next::Encode::encode(&self.data, encoder_, data, (4294967295, ()))?;
665
666 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(data.as_mut_ptr()) };
667 ::fidl_next::Constrained::validate(_field, (4294967295, ()))?;
668
669 Ok(())
670 }
671 }
672
673 unsafe impl<___E>
674 ::fidl_next::EncodeOption<
675 ::fidl_next::wire::Box<'static, crate::wire::DeviceWriteRequest<'static>>,
676 ___E,
677 > for DeviceWriteRequest
678 where
679 ___E: ::fidl_next::Encoder + ?Sized,
680 DeviceWriteRequest: ::fidl_next::Encode<crate::wire::DeviceWriteRequest<'static>, ___E>,
681 {
682 #[inline]
683 fn encode_option(
684 this: ::core::option::Option<Self>,
685 encoder: &mut ___E,
686 out: &mut ::core::mem::MaybeUninit<
687 ::fidl_next::wire::Box<'static, crate::wire::DeviceWriteRequest<'static>>,
688 >,
689 _: (),
690 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
691 if let Some(inner) = this {
692 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
693 ::fidl_next::wire::Box::encode_present(out);
694 } else {
695 ::fidl_next::wire::Box::encode_absent(out);
696 }
697
698 Ok(())
699 }
700 }
701
702 unsafe impl<'a, ___E>
703 ::fidl_next::EncodeOption<
704 ::fidl_next::wire::Box<'static, crate::wire::DeviceWriteRequest<'static>>,
705 ___E,
706 > for &'a DeviceWriteRequest
707 where
708 ___E: ::fidl_next::Encoder + ?Sized,
709 &'a DeviceWriteRequest: ::fidl_next::Encode<crate::wire::DeviceWriteRequest<'static>, ___E>,
710 {
711 #[inline]
712 fn encode_option(
713 this: ::core::option::Option<Self>,
714 encoder: &mut ___E,
715 out: &mut ::core::mem::MaybeUninit<
716 ::fidl_next::wire::Box<'static, crate::wire::DeviceWriteRequest<'static>>,
717 >,
718 _: (),
719 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
720 if let Some(inner) = this {
721 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
722 ::fidl_next::wire::Box::encode_present(out);
723 } else {
724 ::fidl_next::wire::Box::encode_absent(out);
725 }
726
727 Ok(())
728 }
729 }
730
731 impl<'de> ::fidl_next::FromWire<crate::wire::DeviceWriteRequest<'de>> for DeviceWriteRequest {
732 #[inline]
733 fn from_wire(wire: crate::wire::DeviceWriteRequest<'de>) -> Self {
734 Self { data: ::fidl_next::FromWire::from_wire(wire.data) }
735 }
736 }
737
738 impl<'de> ::fidl_next::FromWireRef<crate::wire::DeviceWriteRequest<'de>> for DeviceWriteRequest {
739 #[inline]
740 fn from_wire_ref(wire: &crate::wire::DeviceWriteRequest<'de>) -> Self {
741 Self { data: ::fidl_next::FromWireRef::from_wire_ref(&wire.data) }
742 }
743 }
744
745 pub type DeviceWriteResponse = ();
746
747 pub type DeviceCancelAllResponse = ();
748}
749
750pub mod wire {
751
752 #[derive(Clone, Debug)]
754 #[repr(C)]
755 pub struct DeviceGetInfoResponse {
756 pub info: ::fidl_next_common_fuchsia_hardware_serial::wire::SerialPortInfo,
757 }
758
759 static_assertions::const_assert_eq!(std::mem::size_of::<DeviceGetInfoResponse>(), 12);
760 static_assertions::const_assert_eq!(std::mem::align_of::<DeviceGetInfoResponse>(), 4);
761
762 static_assertions::const_assert_eq!(std::mem::offset_of!(DeviceGetInfoResponse, info), 0);
763
764 impl ::fidl_next::Constrained for DeviceGetInfoResponse {
765 type Constraint = ();
766
767 fn validate(
768 _: ::fidl_next::Slot<'_, Self>,
769 _: Self::Constraint,
770 ) -> Result<(), ::fidl_next::ValidationError> {
771 Ok(())
772 }
773 }
774
775 unsafe impl ::fidl_next::Wire for DeviceGetInfoResponse {
776 type Narrowed<'de> = DeviceGetInfoResponse;
777
778 #[inline]
779 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
780 ::fidl_next::munge! {
781 let Self {
782 info,
783
784 } = &mut *out_;
785 }
786
787 ::fidl_next::Wire::zero_padding(info);
788 }
789 }
790
791 unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceGetInfoResponse
792 where
793 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
794 {
795 fn decode(
796 slot_: ::fidl_next::Slot<'_, Self>,
797 decoder_: &mut ___D,
798 _: (),
799 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
800 ::fidl_next::munge! {
801 let Self {
802 mut info,
803
804 } = slot_;
805 }
806
807 let _field = info.as_mut();
808
809 ::fidl_next::Decode::decode(info.as_mut(), decoder_, ())?;
810
811 Ok(())
812 }
813 }
814
815 impl ::fidl_next::IntoNatural for DeviceGetInfoResponse {
816 type Natural = crate::natural::DeviceGetInfoResponse;
817 }
818
819 #[derive(Clone, Debug)]
821 #[repr(C)]
822 pub struct DeviceConfigRequest {
823 pub baud_rate: ::fidl_next::wire::Uint32,
824
825 pub flags: ::fidl_next::wire::Uint32,
826 }
827
828 static_assertions::const_assert_eq!(std::mem::size_of::<DeviceConfigRequest>(), 8);
829 static_assertions::const_assert_eq!(std::mem::align_of::<DeviceConfigRequest>(), 4);
830
831 static_assertions::const_assert_eq!(std::mem::offset_of!(DeviceConfigRequest, baud_rate), 0);
832
833 static_assertions::const_assert_eq!(std::mem::offset_of!(DeviceConfigRequest, flags), 4);
834
835 impl ::fidl_next::Constrained for DeviceConfigRequest {
836 type Constraint = ();
837
838 fn validate(
839 _: ::fidl_next::Slot<'_, Self>,
840 _: Self::Constraint,
841 ) -> Result<(), ::fidl_next::ValidationError> {
842 Ok(())
843 }
844 }
845
846 unsafe impl ::fidl_next::Wire for DeviceConfigRequest {
847 type Narrowed<'de> = DeviceConfigRequest;
848
849 #[inline]
850 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
851 ::fidl_next::munge! {
852 let Self {
853 baud_rate,
854 flags,
855
856 } = &mut *out_;
857 }
858
859 ::fidl_next::Wire::zero_padding(baud_rate);
860
861 ::fidl_next::Wire::zero_padding(flags);
862 }
863 }
864
865 unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceConfigRequest
866 where
867 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
868 {
869 fn decode(
870 slot_: ::fidl_next::Slot<'_, Self>,
871 decoder_: &mut ___D,
872 _: (),
873 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
874 ::fidl_next::munge! {
875 let Self {
876 mut baud_rate,
877 mut flags,
878
879 } = slot_;
880 }
881
882 let _field = baud_rate.as_mut();
883
884 ::fidl_next::Decode::decode(baud_rate.as_mut(), decoder_, ())?;
885
886 let _field = flags.as_mut();
887
888 ::fidl_next::Decode::decode(flags.as_mut(), decoder_, ())?;
889
890 Ok(())
891 }
892 }
893
894 impl ::fidl_next::IntoNatural for DeviceConfigRequest {
895 type Natural = crate::natural::DeviceConfigRequest;
896 }
897
898 pub type DeviceConfigResponse = ::fidl_next::wire::Unit;
900
901 #[derive(Clone, Debug)]
903 #[repr(C)]
904 pub struct DeviceEnableRequest {
905 pub enable: bool,
906 }
907
908 static_assertions::const_assert_eq!(std::mem::size_of::<DeviceEnableRequest>(), 1);
909 static_assertions::const_assert_eq!(std::mem::align_of::<DeviceEnableRequest>(), 1);
910
911 static_assertions::const_assert_eq!(std::mem::offset_of!(DeviceEnableRequest, enable), 0);
912
913 impl ::fidl_next::Constrained for DeviceEnableRequest {
914 type Constraint = ();
915
916 fn validate(
917 _: ::fidl_next::Slot<'_, Self>,
918 _: Self::Constraint,
919 ) -> Result<(), ::fidl_next::ValidationError> {
920 Ok(())
921 }
922 }
923
924 unsafe impl ::fidl_next::Wire for DeviceEnableRequest {
925 type Narrowed<'de> = DeviceEnableRequest;
926
927 #[inline]
928 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
929 ::fidl_next::munge! {
930 let Self {
931 enable,
932
933 } = &mut *out_;
934 }
935
936 ::fidl_next::Wire::zero_padding(enable);
937 }
938 }
939
940 unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceEnableRequest
941 where
942 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
943 {
944 fn decode(
945 slot_: ::fidl_next::Slot<'_, Self>,
946 decoder_: &mut ___D,
947 _: (),
948 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
949 ::fidl_next::munge! {
950 let Self {
951 mut enable,
952
953 } = slot_;
954 }
955
956 let _field = enable.as_mut();
957
958 ::fidl_next::Decode::decode(enable.as_mut(), decoder_, ())?;
959
960 Ok(())
961 }
962 }
963
964 impl ::fidl_next::IntoNatural for DeviceEnableRequest {
965 type Natural = crate::natural::DeviceEnableRequest;
966 }
967
968 pub type DeviceEnableResponse = ::fidl_next::wire::Unit;
970
971 #[derive(Debug)]
973 #[repr(C)]
974 pub struct DeviceReadResponse<'de> {
975 pub data: ::fidl_next::wire::Vector<'de, u8>,
976 }
977
978 static_assertions::const_assert_eq!(std::mem::size_of::<DeviceReadResponse<'_>>(), 16);
979 static_assertions::const_assert_eq!(std::mem::align_of::<DeviceReadResponse<'_>>(), 8);
980
981 static_assertions::const_assert_eq!(std::mem::offset_of!(DeviceReadResponse<'_>, data), 0);
982
983 impl ::fidl_next::Constrained for DeviceReadResponse<'_> {
984 type Constraint = ();
985
986 fn validate(
987 _: ::fidl_next::Slot<'_, Self>,
988 _: Self::Constraint,
989 ) -> Result<(), ::fidl_next::ValidationError> {
990 Ok(())
991 }
992 }
993
994 unsafe impl ::fidl_next::Wire for DeviceReadResponse<'static> {
995 type Narrowed<'de> = DeviceReadResponse<'de>;
996
997 #[inline]
998 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
999 ::fidl_next::munge! {
1000 let Self {
1001 data,
1002
1003 } = &mut *out_;
1004 }
1005
1006 ::fidl_next::Wire::zero_padding(data);
1007 }
1008 }
1009
1010 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for DeviceReadResponse<'de>
1011 where
1012 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1013 ___D: ::fidl_next::Decoder<'de>,
1014 {
1015 fn decode(
1016 slot_: ::fidl_next::Slot<'_, Self>,
1017 decoder_: &mut ___D,
1018 _: (),
1019 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1020 ::fidl_next::munge! {
1021 let Self {
1022 mut data,
1023
1024 } = slot_;
1025 }
1026
1027 let _field = data.as_mut();
1028 ::fidl_next::Constrained::validate(_field, (4294967295, ()))?;
1029 ::fidl_next::Decode::decode(data.as_mut(), decoder_, (4294967295, ()))?;
1030
1031 Ok(())
1032 }
1033 }
1034
1035 impl<'de> ::fidl_next::IntoNatural for DeviceReadResponse<'de> {
1036 type Natural = crate::natural::DeviceReadResponse;
1037 }
1038
1039 #[derive(Debug)]
1041 #[repr(C)]
1042 pub struct DeviceWriteRequest<'de> {
1043 pub data: ::fidl_next::wire::Vector<'de, u8>,
1044 }
1045
1046 static_assertions::const_assert_eq!(std::mem::size_of::<DeviceWriteRequest<'_>>(), 16);
1047 static_assertions::const_assert_eq!(std::mem::align_of::<DeviceWriteRequest<'_>>(), 8);
1048
1049 static_assertions::const_assert_eq!(std::mem::offset_of!(DeviceWriteRequest<'_>, data), 0);
1050
1051 impl ::fidl_next::Constrained for DeviceWriteRequest<'_> {
1052 type Constraint = ();
1053
1054 fn validate(
1055 _: ::fidl_next::Slot<'_, Self>,
1056 _: Self::Constraint,
1057 ) -> Result<(), ::fidl_next::ValidationError> {
1058 Ok(())
1059 }
1060 }
1061
1062 unsafe impl ::fidl_next::Wire for DeviceWriteRequest<'static> {
1063 type Narrowed<'de> = DeviceWriteRequest<'de>;
1064
1065 #[inline]
1066 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1067 ::fidl_next::munge! {
1068 let Self {
1069 data,
1070
1071 } = &mut *out_;
1072 }
1073
1074 ::fidl_next::Wire::zero_padding(data);
1075 }
1076 }
1077
1078 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for DeviceWriteRequest<'de>
1079 where
1080 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1081 ___D: ::fidl_next::Decoder<'de>,
1082 {
1083 fn decode(
1084 slot_: ::fidl_next::Slot<'_, Self>,
1085 decoder_: &mut ___D,
1086 _: (),
1087 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1088 ::fidl_next::munge! {
1089 let Self {
1090 mut data,
1091
1092 } = slot_;
1093 }
1094
1095 let _field = data.as_mut();
1096 ::fidl_next::Constrained::validate(_field, (4294967295, ()))?;
1097 ::fidl_next::Decode::decode(data.as_mut(), decoder_, (4294967295, ()))?;
1098
1099 Ok(())
1100 }
1101 }
1102
1103 impl<'de> ::fidl_next::IntoNatural for DeviceWriteRequest<'de> {
1104 type Natural = crate::natural::DeviceWriteRequest;
1105 }
1106
1107 pub type DeviceWriteResponse = ::fidl_next::wire::Unit;
1109
1110 pub type DeviceCancelAllResponse = ::fidl_next::wire::Unit;
1112}
1113
1114pub mod wire_optional {}
1115
1116pub mod generic {
1117
1118 pub struct DeviceGetInfoResponse<T0> {
1120 pub info: T0,
1121 }
1122
1123 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceGetInfoResponse, ___E>
1124 for DeviceGetInfoResponse<T0>
1125 where
1126 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1127 T0: ::fidl_next::Encode<
1128 ::fidl_next_common_fuchsia_hardware_serial::wire::SerialPortInfo,
1129 ___E,
1130 >,
1131 {
1132 #[inline]
1133 fn encode(
1134 self,
1135 encoder_: &mut ___E,
1136 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetInfoResponse>,
1137 _: (),
1138 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1139 ::fidl_next::munge! {
1140 let crate::wire::DeviceGetInfoResponse {
1141 info,
1142
1143 } = out_;
1144 }
1145
1146 ::fidl_next::Encode::encode(self.info, encoder_, info, ())?;
1147
1148 Ok(())
1149 }
1150 }
1151
1152 pub struct DeviceConfigRequest<T0, T1> {
1154 pub baud_rate: T0,
1155
1156 pub flags: T1,
1157 }
1158
1159 unsafe impl<___E, T0, T1> ::fidl_next::Encode<crate::wire::DeviceConfigRequest, ___E>
1160 for DeviceConfigRequest<T0, T1>
1161 where
1162 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1163 T0: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
1164 T1: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
1165 {
1166 #[inline]
1167 fn encode(
1168 self,
1169 encoder_: &mut ___E,
1170 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceConfigRequest>,
1171 _: (),
1172 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1173 ::fidl_next::munge! {
1174 let crate::wire::DeviceConfigRequest {
1175 baud_rate,
1176 flags,
1177
1178 } = out_;
1179 }
1180
1181 ::fidl_next::Encode::encode(self.baud_rate, encoder_, baud_rate, ())?;
1182
1183 ::fidl_next::Encode::encode(self.flags, encoder_, flags, ())?;
1184
1185 Ok(())
1186 }
1187 }
1188
1189 pub type DeviceConfigResponse = ();
1191
1192 pub struct DeviceEnableRequest<T0> {
1194 pub enable: T0,
1195 }
1196
1197 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceEnableRequest, ___E>
1198 for DeviceEnableRequest<T0>
1199 where
1200 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1201 T0: ::fidl_next::Encode<bool, ___E>,
1202 {
1203 #[inline]
1204 fn encode(
1205 self,
1206 encoder_: &mut ___E,
1207 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceEnableRequest>,
1208 _: (),
1209 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1210 ::fidl_next::munge! {
1211 let crate::wire::DeviceEnableRequest {
1212 enable,
1213
1214 } = out_;
1215 }
1216
1217 ::fidl_next::Encode::encode(self.enable, encoder_, enable, ())?;
1218
1219 Ok(())
1220 }
1221 }
1222
1223 pub type DeviceEnableResponse = ();
1225
1226 pub struct DeviceReadResponse<T0> {
1228 pub data: T0,
1229 }
1230
1231 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceReadResponse<'static>, ___E>
1232 for DeviceReadResponse<T0>
1233 where
1234 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1235 ___E: ::fidl_next::Encoder,
1236 T0: ::fidl_next::Encode<::fidl_next::wire::Vector<'static, u8>, ___E>,
1237 {
1238 #[inline]
1239 fn encode(
1240 self,
1241 encoder_: &mut ___E,
1242 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceReadResponse<'static>>,
1243 _: (),
1244 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1245 ::fidl_next::munge! {
1246 let crate::wire::DeviceReadResponse {
1247 data,
1248
1249 } = out_;
1250 }
1251
1252 ::fidl_next::Encode::encode(self.data, encoder_, data, (4294967295, ()))?;
1253
1254 Ok(())
1255 }
1256 }
1257
1258 pub struct DeviceWriteRequest<T0> {
1260 pub data: T0,
1261 }
1262
1263 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceWriteRequest<'static>, ___E>
1264 for DeviceWriteRequest<T0>
1265 where
1266 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1267 ___E: ::fidl_next::Encoder,
1268 T0: ::fidl_next::Encode<::fidl_next::wire::Vector<'static, u8>, ___E>,
1269 {
1270 #[inline]
1271 fn encode(
1272 self,
1273 encoder_: &mut ___E,
1274 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceWriteRequest<'static>>,
1275 _: (),
1276 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1277 ::fidl_next::munge! {
1278 let crate::wire::DeviceWriteRequest {
1279 data,
1280
1281 } = out_;
1282 }
1283
1284 ::fidl_next::Encode::encode(self.data, encoder_, data, (4294967295, ()))?;
1285
1286 Ok(())
1287 }
1288 }
1289
1290 pub type DeviceWriteResponse = ();
1292
1293 pub type DeviceCancelAllResponse = ();
1295}
1296
1297pub use self::natural::*;
1298
1299#[derive(PartialEq, Debug)]
1301pub struct Device;
1302
1303#[cfg(feature = "driver")]
1304impl ::fidl_next::HasTransport for Device {
1305 type Transport = ::fdf_fidl::DriverChannel;
1306}
1307
1308pub mod device {
1309 pub mod prelude {
1310 pub use crate::{
1311 Device, DeviceClientHandler, DeviceLocalClientHandler, DeviceLocalServerHandler,
1312 DeviceServerHandler, device,
1313 };
1314
1315 pub use crate::natural::DeviceConfigRequest;
1316
1317 pub use crate::natural::DeviceEnableRequest;
1318
1319 pub use crate::natural::DeviceWriteRequest;
1320
1321 pub use crate::natural::DeviceCancelAllResponse;
1322
1323 pub use crate::natural::DeviceConfigResponse;
1324
1325 pub use crate::natural::DeviceEnableResponse;
1326
1327 pub use crate::natural::DeviceGetInfoResponse;
1328
1329 pub use crate::natural::DeviceReadResponse;
1330
1331 pub use crate::natural::DeviceWriteResponse;
1332 }
1333
1334 pub struct GetInfo;
1335
1336 impl ::fidl_next::Method for GetInfo {
1337 const ORDINAL: u64 = 4293470822215791047;
1338 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1339 ::fidl_next::protocol::Flexibility::Flexible;
1340
1341 type Protocol = crate::Device;
1342
1343 type Request = ::fidl_next::wire::EmptyMessageBody;
1344 }
1345
1346 impl ::fidl_next::TwoWayMethod for GetInfo {
1347 type Response = ::fidl_next::wire::Result<
1348 'static,
1349 crate::wire::DeviceGetInfoResponse,
1350 ::fidl_next::wire::fuchsia::StatusResult,
1351 >;
1352 }
1353
1354 impl<___R> ::fidl_next::Respond<___R> for GetInfo {
1355 type Output = ::core::result::Result<
1356 crate::generic::DeviceGetInfoResponse<___R>,
1357 ::fidl_next::never::Never,
1358 >;
1359
1360 fn respond(response: ___R) -> Self::Output {
1361 ::core::result::Result::Ok(crate::generic::DeviceGetInfoResponse { info: response })
1362 }
1363 }
1364
1365 impl<___R> ::fidl_next::RespondErr<___R> for GetInfo {
1366 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
1367
1368 fn respond_err(response: ___R) -> Self::Output {
1369 ::core::result::Result::Err(response)
1370 }
1371 }
1372
1373 pub struct Config;
1374
1375 impl ::fidl_next::Method for Config {
1376 const ORDINAL: u64 = 9101333665396964949;
1377 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1378 ::fidl_next::protocol::Flexibility::Flexible;
1379
1380 type Protocol = crate::Device;
1381
1382 type Request = crate::wire::DeviceConfigRequest;
1383 }
1384
1385 impl ::fidl_next::TwoWayMethod for Config {
1386 type Response = ::fidl_next::wire::Result<
1387 'static,
1388 crate::wire::DeviceConfigResponse,
1389 ::fidl_next::wire::fuchsia::StatusResult,
1390 >;
1391 }
1392
1393 impl<___R> ::fidl_next::Respond<___R> for Config {
1394 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
1395
1396 fn respond(response: ___R) -> Self::Output {
1397 ::core::result::Result::Ok(response)
1398 }
1399 }
1400
1401 impl<___R> ::fidl_next::RespondErr<___R> for Config {
1402 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
1403
1404 fn respond_err(response: ___R) -> Self::Output {
1405 ::core::result::Result::Err(response)
1406 }
1407 }
1408
1409 pub struct Enable;
1410
1411 impl ::fidl_next::Method for Enable {
1412 const ORDINAL: u64 = 8261907286572550878;
1413 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1414 ::fidl_next::protocol::Flexibility::Flexible;
1415
1416 type Protocol = crate::Device;
1417
1418 type Request = crate::wire::DeviceEnableRequest;
1419 }
1420
1421 impl ::fidl_next::TwoWayMethod for Enable {
1422 type Response = ::fidl_next::wire::Result<
1423 'static,
1424 crate::wire::DeviceEnableResponse,
1425 ::fidl_next::wire::fuchsia::StatusResult,
1426 >;
1427 }
1428
1429 impl<___R> ::fidl_next::Respond<___R> for Enable {
1430 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
1431
1432 fn respond(response: ___R) -> Self::Output {
1433 ::core::result::Result::Ok(response)
1434 }
1435 }
1436
1437 impl<___R> ::fidl_next::RespondErr<___R> for Enable {
1438 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
1439
1440 fn respond_err(response: ___R) -> Self::Output {
1441 ::core::result::Result::Err(response)
1442 }
1443 }
1444
1445 pub struct Read;
1446
1447 impl ::fidl_next::Method for Read {
1448 const ORDINAL: u64 = 297271503544427203;
1449 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1450 ::fidl_next::protocol::Flexibility::Flexible;
1451
1452 type Protocol = crate::Device;
1453
1454 type Request = ::fidl_next::wire::EmptyMessageBody;
1455 }
1456
1457 impl ::fidl_next::TwoWayMethod for Read {
1458 type Response = ::fidl_next::wire::Result<
1459 'static,
1460 crate::wire::DeviceReadResponse<'static>,
1461 ::fidl_next::wire::fuchsia::StatusResult,
1462 >;
1463 }
1464
1465 impl<___R> ::fidl_next::Respond<___R> for Read {
1466 type Output = ::core::result::Result<
1467 crate::generic::DeviceReadResponse<___R>,
1468 ::fidl_next::never::Never,
1469 >;
1470
1471 fn respond(response: ___R) -> Self::Output {
1472 ::core::result::Result::Ok(crate::generic::DeviceReadResponse { data: response })
1473 }
1474 }
1475
1476 impl<___R> ::fidl_next::RespondErr<___R> for Read {
1477 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
1478
1479 fn respond_err(response: ___R) -> Self::Output {
1480 ::core::result::Result::Err(response)
1481 }
1482 }
1483
1484 pub struct Write;
1485
1486 impl ::fidl_next::Method for Write {
1487 const ORDINAL: u64 = 178921085719362274;
1488 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1489 ::fidl_next::protocol::Flexibility::Flexible;
1490
1491 type Protocol = crate::Device;
1492
1493 type Request = crate::wire::DeviceWriteRequest<'static>;
1494 }
1495
1496 impl ::fidl_next::TwoWayMethod for Write {
1497 type Response = ::fidl_next::wire::Result<
1498 'static,
1499 crate::wire::DeviceWriteResponse,
1500 ::fidl_next::wire::fuchsia::StatusResult,
1501 >;
1502 }
1503
1504 impl<___R> ::fidl_next::Respond<___R> for Write {
1505 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
1506
1507 fn respond(response: ___R) -> Self::Output {
1508 ::core::result::Result::Ok(response)
1509 }
1510 }
1511
1512 impl<___R> ::fidl_next::RespondErr<___R> for Write {
1513 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
1514
1515 fn respond_err(response: ___R) -> Self::Output {
1516 ::core::result::Result::Err(response)
1517 }
1518 }
1519
1520 pub struct CancelAll;
1521
1522 impl ::fidl_next::Method for CancelAll {
1523 const ORDINAL: u64 = 7893637289785611908;
1524 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1525 ::fidl_next::protocol::Flexibility::Flexible;
1526
1527 type Protocol = crate::Device;
1528
1529 type Request = ::fidl_next::wire::EmptyMessageBody;
1530 }
1531
1532 impl ::fidl_next::TwoWayMethod for CancelAll {
1533 type Response = ::fidl_next::wire::Flexible<'static, crate::wire::DeviceCancelAllResponse>;
1534 }
1535
1536 impl<___R> ::fidl_next::Respond<___R> for CancelAll {
1537 type Output = ::fidl_next::Flexible<___R>;
1538
1539 fn respond(response: ___R) -> Self::Output {
1540 ::fidl_next::Flexible(response)
1541 }
1542 }
1543
1544 mod ___detail {
1545 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Device
1546 where
1547 ___T: ::fidl_next::Transport,
1548 {
1549 type Client = DeviceClient<___T>;
1550 type Server = DeviceServer<___T>;
1551 }
1552
1553 #[repr(transparent)]
1555 pub struct DeviceClient<___T: ::fidl_next::Transport> {
1556 #[allow(dead_code)]
1557 client: ::fidl_next::protocol::Client<___T>,
1558 }
1559
1560 impl<___T> DeviceClient<___T>
1561 where
1562 ___T: ::fidl_next::Transport,
1563 {
1564 pub fn get_info(&self) -> ::fidl_next::TwoWayFuture<'_, super::GetInfo, ___T> {
1565 ::fidl_next::TwoWayFuture::from_untyped(
1566 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
1567 4293470822215791047,
1568 <super::GetInfo as ::fidl_next::Method>::FLEXIBILITY,
1569 (),
1570 ),
1571 )
1572 }
1573
1574 #[doc = " Configures the given serial port.\n Values of `flags` are defined in the constants above.\n\n * error one of the following values:\n * `ZX_ERR_IO_NOT_PRESENT`: The serial controller is in a low-power state or is\n * transitioning to a low-power state.\n * Other values may be returned for driver- or device-specific errors.\n"]
1575 pub fn config(
1576 &self,
1577
1578 baud_rate: impl ::fidl_next::Encode<
1579 ::fidl_next::wire::Uint32,
1580 <___T as ::fidl_next::Transport>::SendBuffer,
1581 >,
1582
1583 flags: impl ::fidl_next::Encode<
1584 ::fidl_next::wire::Uint32,
1585 <___T as ::fidl_next::Transport>::SendBuffer,
1586 >,
1587 ) -> ::fidl_next::TwoWayFuture<'_, super::Config, ___T>
1588 where
1589 <___T as ::fidl_next::Transport>::SendBuffer:
1590 ::fidl_next::encoder::InternalHandleEncoder,
1591 {
1592 self.config_with(crate::generic::DeviceConfigRequest { baud_rate, flags })
1593 }
1594
1595 #[doc = " Configures the given serial port.\n Values of `flags` are defined in the constants above.\n\n * error one of the following values:\n * `ZX_ERR_IO_NOT_PRESENT`: The serial controller is in a low-power state or is\n * transitioning to a low-power state.\n * Other values may be returned for driver- or device-specific errors.\n"]
1596 pub fn config_with<___R>(
1597 &self,
1598 request: ___R,
1599 ) -> ::fidl_next::TwoWayFuture<'_, super::Config, ___T>
1600 where
1601 ___R: ::fidl_next::Encode<
1602 crate::wire::DeviceConfigRequest,
1603 <___T as ::fidl_next::Transport>::SendBuffer,
1604 >,
1605 {
1606 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1607 9101333665396964949,
1608 <super::Config as ::fidl_next::Method>::FLEXIBILITY,
1609 request,
1610 ))
1611 }
1612
1613 #[doc = " Enable or disable the device.\n If already enabled and `enable` is true, this is a no-op and returns successfully.\n If already disabled and `enable` is false, this is a no-op and returns successfully.\n\n + request `enable` true to enable the device, or false to disable it.\n * error one of the following values:\n * `ZX_ERR_BAD_STATE`: `enable` was false, and a `Read()` or `Write()` call was pending.\n * `ZX_ERR_IO_NOT_PRESENT`: The serial controller is in a low-power state or is\n * transitioning to a low-power state.\n"]
1614 pub fn enable(
1615 &self,
1616
1617 enable: impl ::fidl_next::Encode<bool, <___T as ::fidl_next::Transport>::SendBuffer>,
1618 ) -> ::fidl_next::TwoWayFuture<'_, super::Enable, ___T>
1619 where
1620 <___T as ::fidl_next::Transport>::SendBuffer:
1621 ::fidl_next::encoder::InternalHandleEncoder,
1622 {
1623 self.enable_with(crate::generic::DeviceEnableRequest { enable })
1624 }
1625
1626 #[doc = " Enable or disable the device.\n If already enabled and `enable` is true, this is a no-op and returns successfully.\n If already disabled and `enable` is false, this is a no-op and returns successfully.\n\n + request `enable` true to enable the device, or false to disable it.\n * error one of the following values:\n * `ZX_ERR_BAD_STATE`: `enable` was false, and a `Read()` or `Write()` call was pending.\n * `ZX_ERR_IO_NOT_PRESENT`: The serial controller is in a low-power state or is\n * transitioning to a low-power state.\n"]
1627 pub fn enable_with<___R>(
1628 &self,
1629 request: ___R,
1630 ) -> ::fidl_next::TwoWayFuture<'_, super::Enable, ___T>
1631 where
1632 ___R: ::fidl_next::Encode<
1633 crate::wire::DeviceEnableRequest,
1634 <___T as ::fidl_next::Transport>::SendBuffer,
1635 >,
1636 {
1637 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1638 8261907286572550878,
1639 <super::Enable as ::fidl_next::Method>::FLEXIBILITY,
1640 request,
1641 ))
1642 }
1643
1644 #[doc = " Perform a read operation. Returns immediately if data has been received since the last call;\n otherwise the request is completed the next time data is received (clients can use the\n hanging-get pattern to be notified of new data).\n\n - response `data` the bytes read from the device.\n * error one of the following values:\n * `ZX_ERR_BAD_STATE`: The device was not enabled.\n * `ZX_ERR_CANCELED`: The call was canceled by `CancelAll()`.\n * `ZX_ERR_ALREADY_BOUND`: Another `Read()` call was already pending.\n * `ZX_ERR_IO_NOT_PRESENT`: The serial controller is in a low-power state or is\n * transitioning to a low-power state.\n * Other values may be returned for driver- or device-specific errors.\n"]
1645 pub fn read(&self) -> ::fidl_next::TwoWayFuture<'_, super::Read, ___T> {
1646 ::fidl_next::TwoWayFuture::from_untyped(
1647 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
1648 297271503544427203,
1649 <super::Read as ::fidl_next::Method>::FLEXIBILITY,
1650 (),
1651 ),
1652 )
1653 }
1654
1655 #[doc = " Perform a write operation. Returns when all bytes have been written, or when an error is\n encountered.\n\n + request `data` the bytes to write to the device.\n * error one of the following values:\n * `ZX_ERR_BAD_STATE`: The device was not enabled.\n * `ZX_ERR_CANCELED`: The call was canceled by `CancelAll()`.\n * `ZX_ERR_ALREADY_BOUND`: Another `Write()` call was already pending.\n * `ZX_ERR_IO_NOT_PRESENT`: The serial controller is in a low-power state or is\n * transitioning to a low-power state.\n * Other values may be returned for driver- or device-specific errors.\n"]
1656 pub fn write(
1657 &self,
1658
1659 data: impl ::fidl_next::Encode<
1660 ::fidl_next::wire::Vector<'static, u8>,
1661 <___T as ::fidl_next::Transport>::SendBuffer,
1662 >,
1663 ) -> ::fidl_next::TwoWayFuture<'_, super::Write, ___T>
1664 where
1665 <___T as ::fidl_next::Transport>::SendBuffer:
1666 ::fidl_next::encoder::InternalHandleEncoder,
1667 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
1668 {
1669 self.write_with(crate::generic::DeviceWriteRequest { data })
1670 }
1671
1672 #[doc = " Perform a write operation. Returns when all bytes have been written, or when an error is\n encountered.\n\n + request `data` the bytes to write to the device.\n * error one of the following values:\n * `ZX_ERR_BAD_STATE`: The device was not enabled.\n * `ZX_ERR_CANCELED`: The call was canceled by `CancelAll()`.\n * `ZX_ERR_ALREADY_BOUND`: Another `Write()` call was already pending.\n * `ZX_ERR_IO_NOT_PRESENT`: The serial controller is in a low-power state or is\n * transitioning to a low-power state.\n * Other values may be returned for driver- or device-specific errors.\n"]
1673 pub fn write_with<___R>(
1674 &self,
1675 request: ___R,
1676 ) -> ::fidl_next::TwoWayFuture<'_, super::Write, ___T>
1677 where
1678 ___R: ::fidl_next::Encode<
1679 crate::wire::DeviceWriteRequest<'static>,
1680 <___T as ::fidl_next::Transport>::SendBuffer,
1681 >,
1682 {
1683 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1684 178921085719362274,
1685 <super::Write as ::fidl_next::Method>::FLEXIBILITY,
1686 request,
1687 ))
1688 }
1689
1690 #[doc = " Immediately cancels all outstanding asynchronous I/O\n"]
1691 pub fn cancel_all(&self) -> ::fidl_next::TwoWayFuture<'_, super::CancelAll, ___T> {
1692 ::fidl_next::TwoWayFuture::from_untyped(
1693 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
1694 7893637289785611908,
1695 <super::CancelAll as ::fidl_next::Method>::FLEXIBILITY,
1696 (),
1697 ),
1698 )
1699 }
1700 }
1701
1702 #[repr(transparent)]
1704 pub struct DeviceServer<___T: ::fidl_next::Transport> {
1705 server: ::fidl_next::protocol::Server<___T>,
1706 }
1707
1708 impl<___T> DeviceServer<___T> where ___T: ::fidl_next::Transport {}
1709 }
1710}
1711
1712#[diagnostic::on_unimplemented(
1713 note = "If {Self} implements the non-local DeviceClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
1714)]
1715
1716pub trait DeviceLocalClientHandler<
1720 #[cfg(feature = "driver")] ___T: ::fidl_next::Transport = ::fdf_fidl::DriverChannel,
1721 #[cfg(not(feature = "driver"))] ___T: ::fidl_next::Transport,
1722>
1723{
1724 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
1725 ::core::future::ready(())
1726 }
1727}
1728
1729impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Device
1730where
1731 ___H: DeviceLocalClientHandler<___T>,
1732 ___T: ::fidl_next::Transport,
1733{
1734 async fn on_event(
1735 handler: &mut ___H,
1736 mut message: ::fidl_next::Message<___T>,
1737 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1738 match *message.header().ordinal {
1739 ordinal => {
1740 handler.on_unknown_interaction(ordinal).await;
1741 if ::core::matches!(
1742 message.header().flexibility(),
1743 ::fidl_next::protocol::Flexibility::Strict
1744 ) {
1745 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1746 } else {
1747 Ok(())
1748 }
1749 }
1750 }
1751 }
1752}
1753
1754#[diagnostic::on_unimplemented(
1755 note = "If {Self} implements the non-local DeviceServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
1756)]
1757
1758pub trait DeviceLocalServerHandler<
1762 #[cfg(feature = "driver")] ___T: ::fidl_next::Transport = ::fdf_fidl::DriverChannel,
1763 #[cfg(not(feature = "driver"))] ___T: ::fidl_next::Transport,
1764>
1765{
1766 fn get_info(
1767 &mut self,
1768
1769 responder: ::fidl_next::Responder<device::GetInfo, ___T>,
1770 ) -> impl ::core::future::Future<Output = ()>;
1771
1772 #[doc = " Configures the given serial port.\n Values of `flags` are defined in the constants above.\n\n * error one of the following values:\n * `ZX_ERR_IO_NOT_PRESENT`: The serial controller is in a low-power state or is\n * transitioning to a low-power state.\n * Other values may be returned for driver- or device-specific errors.\n"]
1773 fn config(
1774 &mut self,
1775
1776 request: ::fidl_next::Request<device::Config, ___T>,
1777
1778 responder: ::fidl_next::Responder<device::Config, ___T>,
1779 ) -> impl ::core::future::Future<Output = ()>;
1780
1781 #[doc = " Enable or disable the device.\n If already enabled and `enable` is true, this is a no-op and returns successfully.\n If already disabled and `enable` is false, this is a no-op and returns successfully.\n\n + request `enable` true to enable the device, or false to disable it.\n * error one of the following values:\n * `ZX_ERR_BAD_STATE`: `enable` was false, and a `Read()` or `Write()` call was pending.\n * `ZX_ERR_IO_NOT_PRESENT`: The serial controller is in a low-power state or is\n * transitioning to a low-power state.\n"]
1782 fn enable(
1783 &mut self,
1784
1785 request: ::fidl_next::Request<device::Enable, ___T>,
1786
1787 responder: ::fidl_next::Responder<device::Enable, ___T>,
1788 ) -> impl ::core::future::Future<Output = ()>;
1789
1790 #[doc = " Perform a read operation. Returns immediately if data has been received since the last call;\n otherwise the request is completed the next time data is received (clients can use the\n hanging-get pattern to be notified of new data).\n\n - response `data` the bytes read from the device.\n * error one of the following values:\n * `ZX_ERR_BAD_STATE`: The device was not enabled.\n * `ZX_ERR_CANCELED`: The call was canceled by `CancelAll()`.\n * `ZX_ERR_ALREADY_BOUND`: Another `Read()` call was already pending.\n * `ZX_ERR_IO_NOT_PRESENT`: The serial controller is in a low-power state or is\n * transitioning to a low-power state.\n * Other values may be returned for driver- or device-specific errors.\n"]
1791 fn read(
1792 &mut self,
1793
1794 responder: ::fidl_next::Responder<device::Read, ___T>,
1795 ) -> impl ::core::future::Future<Output = ()>;
1796
1797 #[doc = " Perform a write operation. Returns when all bytes have been written, or when an error is\n encountered.\n\n + request `data` the bytes to write to the device.\n * error one of the following values:\n * `ZX_ERR_BAD_STATE`: The device was not enabled.\n * `ZX_ERR_CANCELED`: The call was canceled by `CancelAll()`.\n * `ZX_ERR_ALREADY_BOUND`: Another `Write()` call was already pending.\n * `ZX_ERR_IO_NOT_PRESENT`: The serial controller is in a low-power state or is\n * transitioning to a low-power state.\n * Other values may be returned for driver- or device-specific errors.\n"]
1798 fn write(
1799 &mut self,
1800
1801 request: ::fidl_next::Request<device::Write, ___T>,
1802
1803 responder: ::fidl_next::Responder<device::Write, ___T>,
1804 ) -> impl ::core::future::Future<Output = ()>;
1805
1806 #[doc = " Immediately cancels all outstanding asynchronous I/O\n"]
1807 fn cancel_all(
1808 &mut self,
1809
1810 responder: ::fidl_next::Responder<device::CancelAll, ___T>,
1811 ) -> impl ::core::future::Future<Output = ()>;
1812
1813 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
1814 ::core::future::ready(())
1815 }
1816}
1817
1818impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Device
1819where
1820 ___H: DeviceLocalServerHandler<___T>,
1821 ___T: ::fidl_next::Transport,
1822 for<'de> crate::wire::DeviceConfigRequest: ::fidl_next::Decode<
1823 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1824 Constraint = (),
1825 >,
1826 for<'de> crate::wire::DeviceEnableRequest: ::fidl_next::Decode<
1827 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1828 Constraint = (),
1829 >,
1830 for<'de> crate::wire::DeviceWriteRequest<'de>: ::fidl_next::Decode<
1831 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1832 Constraint = (),
1833 >,
1834{
1835 async fn on_one_way(
1836 handler: &mut ___H,
1837 mut message: ::fidl_next::Message<___T>,
1838 ) -> ::core::result::Result<
1839 (),
1840 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1841 > {
1842 match *message.header().ordinal {
1843 ordinal => {
1844 handler.on_unknown_interaction(ordinal).await;
1845 if ::core::matches!(
1846 message.header().flexibility(),
1847 ::fidl_next::protocol::Flexibility::Strict
1848 ) {
1849 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1850 } else {
1851 Ok(())
1852 }
1853 }
1854 }
1855 }
1856
1857 async fn on_two_way(
1858 handler: &mut ___H,
1859 mut message: ::fidl_next::Message<___T>,
1860 responder: ::fidl_next::protocol::Responder<___T>,
1861 ) -> ::core::result::Result<
1862 (),
1863 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1864 > {
1865 match *message.header().ordinal {
1866 4293470822215791047 => {
1867 let responder = ::fidl_next::Responder::from_untyped(responder);
1868
1869 handler.get_info(responder).await;
1870 Ok(())
1871 }
1872
1873 9101333665396964949 => {
1874 let responder = ::fidl_next::Responder::from_untyped(responder);
1875
1876 match ::fidl_next::AsDecoderExt::into_decoded(message) {
1877 Ok(decoded) => {
1878 handler
1879 .config(::fidl_next::Request::from_decoded(decoded), responder)
1880 .await;
1881 Ok(())
1882 }
1883 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1884 ordinal: 9101333665396964949,
1885 error,
1886 }),
1887 }
1888 }
1889
1890 8261907286572550878 => {
1891 let responder = ::fidl_next::Responder::from_untyped(responder);
1892
1893 match ::fidl_next::AsDecoderExt::into_decoded(message) {
1894 Ok(decoded) => {
1895 handler
1896 .enable(::fidl_next::Request::from_decoded(decoded), responder)
1897 .await;
1898 Ok(())
1899 }
1900 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1901 ordinal: 8261907286572550878,
1902 error,
1903 }),
1904 }
1905 }
1906
1907 297271503544427203 => {
1908 let responder = ::fidl_next::Responder::from_untyped(responder);
1909
1910 handler.read(responder).await;
1911 Ok(())
1912 }
1913
1914 178921085719362274 => {
1915 let responder = ::fidl_next::Responder::from_untyped(responder);
1916
1917 match ::fidl_next::AsDecoderExt::into_decoded(message) {
1918 Ok(decoded) => {
1919 handler.write(::fidl_next::Request::from_decoded(decoded), responder).await;
1920 Ok(())
1921 }
1922 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1923 ordinal: 178921085719362274,
1924 error,
1925 }),
1926 }
1927 }
1928
1929 7893637289785611908 => {
1930 let responder = ::fidl_next::Responder::from_untyped(responder);
1931
1932 handler.cancel_all(responder).await;
1933 Ok(())
1934 }
1935
1936 ordinal => {
1937 handler.on_unknown_interaction(ordinal).await;
1938 if ::core::matches!(
1939 message.header().flexibility(),
1940 ::fidl_next::protocol::Flexibility::Strict
1941 ) {
1942 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1943 } else {
1944 responder
1945 .respond_framework_error(
1946 ordinal,
1947 ::fidl_next::FrameworkError::UnknownMethod,
1948 )
1949 .expect("encoding a framework error should never fail")
1950 .await?;
1951 Ok(())
1952 }
1953 }
1954 }
1955 }
1956}
1957
1958pub trait DeviceClientHandler<
1962 #[cfg(feature = "driver")] ___T: ::fidl_next::Transport = ::fdf_fidl::DriverChannel,
1963 #[cfg(not(feature = "driver"))] ___T: ::fidl_next::Transport,
1964>
1965{
1966 fn on_unknown_interaction(
1967 &mut self,
1968 ordinal: u64,
1969 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
1970 ::core::future::ready(())
1971 }
1972}
1973
1974impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Device
1975where
1976 ___H: DeviceClientHandler<___T> + ::core::marker::Send,
1977 ___T: ::fidl_next::Transport,
1978{
1979 async fn on_event(
1980 handler: &mut ___H,
1981 mut message: ::fidl_next::Message<___T>,
1982 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1983 match *message.header().ordinal {
1984 ordinal => {
1985 handler.on_unknown_interaction(ordinal).await;
1986 if ::core::matches!(
1987 message.header().flexibility(),
1988 ::fidl_next::protocol::Flexibility::Strict
1989 ) {
1990 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1991 } else {
1992 Ok(())
1993 }
1994 }
1995 }
1996 }
1997}
1998
1999pub trait DeviceServerHandler<
2003 #[cfg(feature = "driver")] ___T: ::fidl_next::Transport = ::fdf_fidl::DriverChannel,
2004 #[cfg(not(feature = "driver"))] ___T: ::fidl_next::Transport,
2005>
2006{
2007 fn get_info(
2008 &mut self,
2009
2010 responder: ::fidl_next::Responder<device::GetInfo, ___T>,
2011 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2012
2013 #[doc = " Configures the given serial port.\n Values of `flags` are defined in the constants above.\n\n * error one of the following values:\n * `ZX_ERR_IO_NOT_PRESENT`: The serial controller is in a low-power state or is\n * transitioning to a low-power state.\n * Other values may be returned for driver- or device-specific errors.\n"]
2014 fn config(
2015 &mut self,
2016
2017 request: ::fidl_next::Request<device::Config, ___T>,
2018
2019 responder: ::fidl_next::Responder<device::Config, ___T>,
2020 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2021
2022 #[doc = " Enable or disable the device.\n If already enabled and `enable` is true, this is a no-op and returns successfully.\n If already disabled and `enable` is false, this is a no-op and returns successfully.\n\n + request `enable` true to enable the device, or false to disable it.\n * error one of the following values:\n * `ZX_ERR_BAD_STATE`: `enable` was false, and a `Read()` or `Write()` call was pending.\n * `ZX_ERR_IO_NOT_PRESENT`: The serial controller is in a low-power state or is\n * transitioning to a low-power state.\n"]
2023 fn enable(
2024 &mut self,
2025
2026 request: ::fidl_next::Request<device::Enable, ___T>,
2027
2028 responder: ::fidl_next::Responder<device::Enable, ___T>,
2029 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2030
2031 #[doc = " Perform a read operation. Returns immediately if data has been received since the last call;\n otherwise the request is completed the next time data is received (clients can use the\n hanging-get pattern to be notified of new data).\n\n - response `data` the bytes read from the device.\n * error one of the following values:\n * `ZX_ERR_BAD_STATE`: The device was not enabled.\n * `ZX_ERR_CANCELED`: The call was canceled by `CancelAll()`.\n * `ZX_ERR_ALREADY_BOUND`: Another `Read()` call was already pending.\n * `ZX_ERR_IO_NOT_PRESENT`: The serial controller is in a low-power state or is\n * transitioning to a low-power state.\n * Other values may be returned for driver- or device-specific errors.\n"]
2032 fn read(
2033 &mut self,
2034
2035 responder: ::fidl_next::Responder<device::Read, ___T>,
2036 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2037
2038 #[doc = " Perform a write operation. Returns when all bytes have been written, or when an error is\n encountered.\n\n + request `data` the bytes to write to the device.\n * error one of the following values:\n * `ZX_ERR_BAD_STATE`: The device was not enabled.\n * `ZX_ERR_CANCELED`: The call was canceled by `CancelAll()`.\n * `ZX_ERR_ALREADY_BOUND`: Another `Write()` call was already pending.\n * `ZX_ERR_IO_NOT_PRESENT`: The serial controller is in a low-power state or is\n * transitioning to a low-power state.\n * Other values may be returned for driver- or device-specific errors.\n"]
2039 fn write(
2040 &mut self,
2041
2042 request: ::fidl_next::Request<device::Write, ___T>,
2043
2044 responder: ::fidl_next::Responder<device::Write, ___T>,
2045 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2046
2047 #[doc = " Immediately cancels all outstanding asynchronous I/O\n"]
2048 fn cancel_all(
2049 &mut self,
2050
2051 responder: ::fidl_next::Responder<device::CancelAll, ___T>,
2052 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2053
2054 fn on_unknown_interaction(
2055 &mut self,
2056 ordinal: u64,
2057 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
2058 ::core::future::ready(())
2059 }
2060}
2061
2062impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Device
2063where
2064 ___H: DeviceServerHandler<___T> + ::core::marker::Send,
2065 ___T: ::fidl_next::Transport,
2066 for<'de> crate::wire::DeviceConfigRequest: ::fidl_next::Decode<
2067 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2068 Constraint = (),
2069 >,
2070 for<'de> crate::wire::DeviceEnableRequest: ::fidl_next::Decode<
2071 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2072 Constraint = (),
2073 >,
2074 for<'de> crate::wire::DeviceWriteRequest<'de>: ::fidl_next::Decode<
2075 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2076 Constraint = (),
2077 >,
2078{
2079 async fn on_one_way(
2080 handler: &mut ___H,
2081 mut message: ::fidl_next::Message<___T>,
2082 ) -> ::core::result::Result<
2083 (),
2084 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
2085 > {
2086 match *message.header().ordinal {
2087 ordinal => {
2088 handler.on_unknown_interaction(ordinal).await;
2089 if ::core::matches!(
2090 message.header().flexibility(),
2091 ::fidl_next::protocol::Flexibility::Strict
2092 ) {
2093 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2094 } else {
2095 Ok(())
2096 }
2097 }
2098 }
2099 }
2100
2101 async fn on_two_way(
2102 handler: &mut ___H,
2103 mut message: ::fidl_next::Message<___T>,
2104 responder: ::fidl_next::protocol::Responder<___T>,
2105 ) -> ::core::result::Result<
2106 (),
2107 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
2108 > {
2109 match *message.header().ordinal {
2110 4293470822215791047 => {
2111 let responder = ::fidl_next::Responder::from_untyped(responder);
2112
2113 handler.get_info(responder).await;
2114 Ok(())
2115 }
2116
2117 9101333665396964949 => {
2118 let responder = ::fidl_next::Responder::from_untyped(responder);
2119
2120 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2121 Ok(decoded) => {
2122 handler
2123 .config(::fidl_next::Request::from_decoded(decoded), responder)
2124 .await;
2125 Ok(())
2126 }
2127 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2128 ordinal: 9101333665396964949,
2129 error,
2130 }),
2131 }
2132 }
2133
2134 8261907286572550878 => {
2135 let responder = ::fidl_next::Responder::from_untyped(responder);
2136
2137 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2138 Ok(decoded) => {
2139 handler
2140 .enable(::fidl_next::Request::from_decoded(decoded), responder)
2141 .await;
2142 Ok(())
2143 }
2144 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2145 ordinal: 8261907286572550878,
2146 error,
2147 }),
2148 }
2149 }
2150
2151 297271503544427203 => {
2152 let responder = ::fidl_next::Responder::from_untyped(responder);
2153
2154 handler.read(responder).await;
2155 Ok(())
2156 }
2157
2158 178921085719362274 => {
2159 let responder = ::fidl_next::Responder::from_untyped(responder);
2160
2161 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2162 Ok(decoded) => {
2163 handler.write(::fidl_next::Request::from_decoded(decoded), responder).await;
2164 Ok(())
2165 }
2166 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2167 ordinal: 178921085719362274,
2168 error,
2169 }),
2170 }
2171 }
2172
2173 7893637289785611908 => {
2174 let responder = ::fidl_next::Responder::from_untyped(responder);
2175
2176 handler.cancel_all(responder).await;
2177 Ok(())
2178 }
2179
2180 ordinal => {
2181 handler.on_unknown_interaction(ordinal).await;
2182 if ::core::matches!(
2183 message.header().flexibility(),
2184 ::fidl_next::protocol::Flexibility::Strict
2185 ) {
2186 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2187 } else {
2188 responder
2189 .respond_framework_error(
2190 ordinal,
2191 ::fidl_next::FrameworkError::UnknownMethod,
2192 )
2193 .expect("encoding a framework error should never fail")
2194 .await?;
2195 Ok(())
2196 }
2197 }
2198 }
2199 }
2200}
2201
2202impl<___T> DeviceClientHandler<___T> for ::fidl_next::IgnoreEvents
2203where
2204 ___T: ::fidl_next::Transport,
2205{
2206 async fn on_unknown_interaction(&mut self, _: u64) {}
2207}
2208
2209impl<___H, ___T> DeviceLocalClientHandler<___T> for ::fidl_next::Local<___H>
2210where
2211 ___H: DeviceClientHandler<___T>,
2212 ___T: ::fidl_next::Transport,
2213{
2214 async fn on_unknown_interaction(&mut self, ordinal: u64) {
2215 ___H::on_unknown_interaction(&mut self.0, ordinal).await
2216 }
2217}
2218
2219impl<___H, ___T> DeviceLocalServerHandler<___T> for ::fidl_next::Local<___H>
2220where
2221 ___H: DeviceServerHandler<___T>,
2222 ___T: ::fidl_next::Transport,
2223{
2224 async fn get_info(&mut self, responder: ::fidl_next::Responder<device::GetInfo, ___T>) {
2225 ___H::get_info(&mut self.0, responder).await
2226 }
2227
2228 async fn config(
2229 &mut self,
2230
2231 request: ::fidl_next::Request<device::Config, ___T>,
2232
2233 responder: ::fidl_next::Responder<device::Config, ___T>,
2234 ) {
2235 ___H::config(&mut self.0, request, responder).await
2236 }
2237
2238 async fn enable(
2239 &mut self,
2240
2241 request: ::fidl_next::Request<device::Enable, ___T>,
2242
2243 responder: ::fidl_next::Responder<device::Enable, ___T>,
2244 ) {
2245 ___H::enable(&mut self.0, request, responder).await
2246 }
2247
2248 async fn read(&mut self, responder: ::fidl_next::Responder<device::Read, ___T>) {
2249 ___H::read(&mut self.0, responder).await
2250 }
2251
2252 async fn write(
2253 &mut self,
2254
2255 request: ::fidl_next::Request<device::Write, ___T>,
2256
2257 responder: ::fidl_next::Responder<device::Write, ___T>,
2258 ) {
2259 ___H::write(&mut self.0, request, responder).await
2260 }
2261
2262 async fn cancel_all(&mut self, responder: ::fidl_next::Responder<device::CancelAll, ___T>) {
2263 ___H::cancel_all(&mut self.0, responder).await
2264 }
2265
2266 async fn on_unknown_interaction(&mut self, ordinal: u64) {
2267 ___H::on_unknown_interaction(&mut self.0, ordinal).await
2268 }
2269}
2270
2271pub const SERIAL_DATA_BITS_5: u32 = 0 as u32;
2272
2273pub const SERIAL_DATA_BITS_6: u32 = 1 as u32;
2274
2275pub const SERIAL_DATA_BITS_7: u32 = 2 as u32;
2276
2277pub const SERIAL_DATA_BITS_8: u32 = 3 as u32;
2278
2279pub const SERIAL_DATA_BITS_MASK: u32 = 3 as u32;
2280
2281pub const SERIAL_FLOW_CTRL_CTS_RTS: u32 = 32 as u32;
2282
2283pub const SERIAL_FLOW_CTRL_MASK: u32 = 32 as u32;
2284
2285pub const SERIAL_FLOW_CTRL_NONE: u32 = 0 as u32;
2286
2287pub const SERIAL_PARITY_EVEN: u32 = 8 as u32;
2288
2289pub const SERIAL_PARITY_MASK: u32 = 24 as u32;
2290
2291pub const SERIAL_PARITY_NONE: u32 = 0 as u32;
2292
2293pub const SERIAL_PARITY_ODD: u32 = 16 as u32;
2294
2295pub const SERIAL_SET_BAUD_RATE_ONLY: u32 = 2147483648 as u32;
2296
2297pub const SERIAL_STOP_BITS_1: u32 = 0 as u32;
2298
2299pub const SERIAL_STOP_BITS_2: u32 = 4 as u32;
2300
2301pub const SERIAL_STOP_BITS_MASK: u32 = 4 as u32;