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 unsafe impl<'a, ___E, T0> ::fidl_next::Encode<crate::wire::DeviceGetInfoResponse, ___E>
1153 for &'a DeviceGetInfoResponse<T0>
1154 where
1155 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1156 &'a T0: ::fidl_next::Encode<
1157 ::fidl_next_common_fuchsia_hardware_serial::wire::SerialPortInfo,
1158 ___E,
1159 >,
1160 {
1161 #[inline]
1162 fn encode(
1163 self,
1164 encoder_: &mut ___E,
1165 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetInfoResponse>,
1166 _: (),
1167 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1168 ::fidl_next::munge! {
1169 let crate::wire::DeviceGetInfoResponse {
1170 info,
1171
1172 } = out_;
1173 }
1174
1175 ::fidl_next::Encode::encode(&self.info, encoder_, info, ())?;
1176
1177 Ok(())
1178 }
1179 }
1180
1181 pub struct DeviceConfigRequest<T0, T1> {
1183 pub baud_rate: T0,
1184
1185 pub flags: T1,
1186 }
1187
1188 unsafe impl<___E, T0, T1> ::fidl_next::Encode<crate::wire::DeviceConfigRequest, ___E>
1189 for DeviceConfigRequest<T0, T1>
1190 where
1191 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1192 T0: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
1193 T1: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
1194 {
1195 #[inline]
1196 fn encode(
1197 self,
1198 encoder_: &mut ___E,
1199 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceConfigRequest>,
1200 _: (),
1201 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1202 ::fidl_next::munge! {
1203 let crate::wire::DeviceConfigRequest {
1204 baud_rate,
1205 flags,
1206
1207 } = out_;
1208 }
1209
1210 ::fidl_next::Encode::encode(self.baud_rate, encoder_, baud_rate, ())?;
1211
1212 ::fidl_next::Encode::encode(self.flags, encoder_, flags, ())?;
1213
1214 Ok(())
1215 }
1216 }
1217
1218 unsafe impl<'a, ___E, T0, T1> ::fidl_next::Encode<crate::wire::DeviceConfigRequest, ___E>
1219 for &'a DeviceConfigRequest<T0, T1>
1220 where
1221 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1222 &'a T0: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
1223 &'a T1: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
1224 {
1225 #[inline]
1226 fn encode(
1227 self,
1228 encoder_: &mut ___E,
1229 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceConfigRequest>,
1230 _: (),
1231 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1232 ::fidl_next::munge! {
1233 let crate::wire::DeviceConfigRequest {
1234 baud_rate,
1235 flags,
1236
1237 } = out_;
1238 }
1239
1240 ::fidl_next::Encode::encode(&self.baud_rate, encoder_, baud_rate, ())?;
1241
1242 ::fidl_next::Encode::encode(&self.flags, encoder_, flags, ())?;
1243
1244 Ok(())
1245 }
1246 }
1247
1248 pub type DeviceConfigResponse = ();
1250
1251 pub struct DeviceEnableRequest<T0> {
1253 pub enable: T0,
1254 }
1255
1256 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceEnableRequest, ___E>
1257 for DeviceEnableRequest<T0>
1258 where
1259 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1260 T0: ::fidl_next::Encode<bool, ___E>,
1261 {
1262 #[inline]
1263 fn encode(
1264 self,
1265 encoder_: &mut ___E,
1266 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceEnableRequest>,
1267 _: (),
1268 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1269 ::fidl_next::munge! {
1270 let crate::wire::DeviceEnableRequest {
1271 enable,
1272
1273 } = out_;
1274 }
1275
1276 ::fidl_next::Encode::encode(self.enable, encoder_, enable, ())?;
1277
1278 Ok(())
1279 }
1280 }
1281
1282 unsafe impl<'a, ___E, T0> ::fidl_next::Encode<crate::wire::DeviceEnableRequest, ___E>
1283 for &'a DeviceEnableRequest<T0>
1284 where
1285 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1286 &'a T0: ::fidl_next::Encode<bool, ___E>,
1287 {
1288 #[inline]
1289 fn encode(
1290 self,
1291 encoder_: &mut ___E,
1292 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceEnableRequest>,
1293 _: (),
1294 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1295 ::fidl_next::munge! {
1296 let crate::wire::DeviceEnableRequest {
1297 enable,
1298
1299 } = out_;
1300 }
1301
1302 ::fidl_next::Encode::encode(&self.enable, encoder_, enable, ())?;
1303
1304 Ok(())
1305 }
1306 }
1307
1308 pub type DeviceEnableResponse = ();
1310
1311 pub struct DeviceReadResponse<T0> {
1313 pub data: T0,
1314 }
1315
1316 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceReadResponse<'static>, ___E>
1317 for DeviceReadResponse<T0>
1318 where
1319 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1320 ___E: ::fidl_next::Encoder,
1321 T0: ::fidl_next::Encode<::fidl_next::wire::Vector<'static, u8>, ___E>,
1322 {
1323 #[inline]
1324 fn encode(
1325 self,
1326 encoder_: &mut ___E,
1327 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceReadResponse<'static>>,
1328 _: (),
1329 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1330 ::fidl_next::munge! {
1331 let crate::wire::DeviceReadResponse {
1332 data,
1333
1334 } = out_;
1335 }
1336
1337 ::fidl_next::Encode::encode(self.data, encoder_, data, (4294967295, ()))?;
1338
1339 Ok(())
1340 }
1341 }
1342
1343 unsafe impl<'a, ___E, T0> ::fidl_next::Encode<crate::wire::DeviceReadResponse<'static>, ___E>
1344 for &'a DeviceReadResponse<T0>
1345 where
1346 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1347 ___E: ::fidl_next::Encoder,
1348 &'a T0: ::fidl_next::Encode<::fidl_next::wire::Vector<'static, u8>, ___E>,
1349 {
1350 #[inline]
1351 fn encode(
1352 self,
1353 encoder_: &mut ___E,
1354 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceReadResponse<'static>>,
1355 _: (),
1356 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1357 ::fidl_next::munge! {
1358 let crate::wire::DeviceReadResponse {
1359 data,
1360
1361 } = out_;
1362 }
1363
1364 ::fidl_next::Encode::encode(&self.data, encoder_, data, (4294967295, ()))?;
1365
1366 Ok(())
1367 }
1368 }
1369
1370 pub struct DeviceWriteRequest<T0> {
1372 pub data: T0,
1373 }
1374
1375 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceWriteRequest<'static>, ___E>
1376 for DeviceWriteRequest<T0>
1377 where
1378 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1379 ___E: ::fidl_next::Encoder,
1380 T0: ::fidl_next::Encode<::fidl_next::wire::Vector<'static, u8>, ___E>,
1381 {
1382 #[inline]
1383 fn encode(
1384 self,
1385 encoder_: &mut ___E,
1386 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceWriteRequest<'static>>,
1387 _: (),
1388 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1389 ::fidl_next::munge! {
1390 let crate::wire::DeviceWriteRequest {
1391 data,
1392
1393 } = out_;
1394 }
1395
1396 ::fidl_next::Encode::encode(self.data, encoder_, data, (4294967295, ()))?;
1397
1398 Ok(())
1399 }
1400 }
1401
1402 unsafe impl<'a, ___E, T0> ::fidl_next::Encode<crate::wire::DeviceWriteRequest<'static>, ___E>
1403 for &'a DeviceWriteRequest<T0>
1404 where
1405 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1406 ___E: ::fidl_next::Encoder,
1407 &'a T0: ::fidl_next::Encode<::fidl_next::wire::Vector<'static, u8>, ___E>,
1408 {
1409 #[inline]
1410 fn encode(
1411 self,
1412 encoder_: &mut ___E,
1413 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceWriteRequest<'static>>,
1414 _: (),
1415 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1416 ::fidl_next::munge! {
1417 let crate::wire::DeviceWriteRequest {
1418 data,
1419
1420 } = out_;
1421 }
1422
1423 ::fidl_next::Encode::encode(&self.data, encoder_, data, (4294967295, ()))?;
1424
1425 Ok(())
1426 }
1427 }
1428
1429 pub type DeviceWriteResponse = ();
1431
1432 pub type DeviceCancelAllResponse = ();
1434}
1435
1436pub use self::natural::*;
1437
1438#[derive(PartialEq, Debug)]
1440pub struct Device;
1441
1442#[cfg(feature = "driver")]
1443impl ::fidl_next::HasTransport for Device {
1444 type Transport = ::fdf_fidl::DriverChannel;
1445}
1446
1447pub mod device {
1448 pub mod prelude {
1449 pub use crate::{
1450 Device, DeviceClientHandler, DeviceLocalClientHandler, DeviceLocalServerHandler,
1451 DeviceServerHandler, device,
1452 };
1453
1454 pub use crate::natural::DeviceConfigRequest;
1455
1456 pub use crate::natural::DeviceEnableRequest;
1457
1458 pub use crate::natural::DeviceWriteRequest;
1459
1460 pub use crate::natural::DeviceCancelAllResponse;
1461
1462 pub use crate::natural::DeviceConfigResponse;
1463
1464 pub use crate::natural::DeviceEnableResponse;
1465
1466 pub use crate::natural::DeviceGetInfoResponse;
1467
1468 pub use crate::natural::DeviceReadResponse;
1469
1470 pub use crate::natural::DeviceWriteResponse;
1471 }
1472
1473 pub struct GetInfo;
1474
1475 impl ::fidl_next::Method for GetInfo {
1476 const ORDINAL: u64 = 4293470822215791047;
1477 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1478 ::fidl_next::protocol::Flexibility::Flexible;
1479
1480 type Protocol = crate::Device;
1481
1482 type Request = ::fidl_next::wire::EmptyMessageBody;
1483 }
1484
1485 impl ::fidl_next::TwoWayMethod for GetInfo {
1486 type Response = ::fidl_next::wire::Result<
1487 'static,
1488 crate::wire::DeviceGetInfoResponse,
1489 ::fidl_next::wire::fuchsia::Status,
1490 >;
1491 }
1492
1493 impl<___R> ::fidl_next::Respond<___R> for GetInfo {
1494 type Output = ::core::result::Result<
1495 crate::generic::DeviceGetInfoResponse<___R>,
1496 ::fidl_next::never::Never,
1497 >;
1498
1499 fn respond(response: ___R) -> Self::Output {
1500 ::core::result::Result::Ok(crate::generic::DeviceGetInfoResponse { info: response })
1501 }
1502 }
1503
1504 impl<___R> ::fidl_next::RespondErr<___R> for GetInfo {
1505 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
1506
1507 fn respond_err(response: ___R) -> Self::Output {
1508 ::core::result::Result::Err(response)
1509 }
1510 }
1511
1512 pub struct Config;
1513
1514 impl ::fidl_next::Method for Config {
1515 const ORDINAL: u64 = 9101333665396964949;
1516 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1517 ::fidl_next::protocol::Flexibility::Flexible;
1518
1519 type Protocol = crate::Device;
1520
1521 type Request = crate::wire::DeviceConfigRequest;
1522 }
1523
1524 impl ::fidl_next::TwoWayMethod for Config {
1525 type Response = ::fidl_next::wire::Result<
1526 'static,
1527 crate::wire::DeviceConfigResponse,
1528 ::fidl_next::wire::fuchsia::Status,
1529 >;
1530 }
1531
1532 impl<___R> ::fidl_next::Respond<___R> for Config {
1533 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
1534
1535 fn respond(response: ___R) -> Self::Output {
1536 ::core::result::Result::Ok(response)
1537 }
1538 }
1539
1540 impl<___R> ::fidl_next::RespondErr<___R> for Config {
1541 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
1542
1543 fn respond_err(response: ___R) -> Self::Output {
1544 ::core::result::Result::Err(response)
1545 }
1546 }
1547
1548 pub struct Enable;
1549
1550 impl ::fidl_next::Method for Enable {
1551 const ORDINAL: u64 = 8261907286572550878;
1552 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1553 ::fidl_next::protocol::Flexibility::Flexible;
1554
1555 type Protocol = crate::Device;
1556
1557 type Request = crate::wire::DeviceEnableRequest;
1558 }
1559
1560 impl ::fidl_next::TwoWayMethod for Enable {
1561 type Response = ::fidl_next::wire::Result<
1562 'static,
1563 crate::wire::DeviceEnableResponse,
1564 ::fidl_next::wire::fuchsia::Status,
1565 >;
1566 }
1567
1568 impl<___R> ::fidl_next::Respond<___R> for Enable {
1569 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
1570
1571 fn respond(response: ___R) -> Self::Output {
1572 ::core::result::Result::Ok(response)
1573 }
1574 }
1575
1576 impl<___R> ::fidl_next::RespondErr<___R> for Enable {
1577 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
1578
1579 fn respond_err(response: ___R) -> Self::Output {
1580 ::core::result::Result::Err(response)
1581 }
1582 }
1583
1584 pub struct Read;
1585
1586 impl ::fidl_next::Method for Read {
1587 const ORDINAL: u64 = 297271503544427203;
1588 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1589 ::fidl_next::protocol::Flexibility::Flexible;
1590
1591 type Protocol = crate::Device;
1592
1593 type Request = ::fidl_next::wire::EmptyMessageBody;
1594 }
1595
1596 impl ::fidl_next::TwoWayMethod for Read {
1597 type Response = ::fidl_next::wire::Result<
1598 'static,
1599 crate::wire::DeviceReadResponse<'static>,
1600 ::fidl_next::wire::fuchsia::Status,
1601 >;
1602 }
1603
1604 impl<___R> ::fidl_next::Respond<___R> for Read {
1605 type Output = ::core::result::Result<
1606 crate::generic::DeviceReadResponse<___R>,
1607 ::fidl_next::never::Never,
1608 >;
1609
1610 fn respond(response: ___R) -> Self::Output {
1611 ::core::result::Result::Ok(crate::generic::DeviceReadResponse { data: response })
1612 }
1613 }
1614
1615 impl<___R> ::fidl_next::RespondErr<___R> for Read {
1616 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
1617
1618 fn respond_err(response: ___R) -> Self::Output {
1619 ::core::result::Result::Err(response)
1620 }
1621 }
1622
1623 pub struct Write;
1624
1625 impl ::fidl_next::Method for Write {
1626 const ORDINAL: u64 = 178921085719362274;
1627 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1628 ::fidl_next::protocol::Flexibility::Flexible;
1629
1630 type Protocol = crate::Device;
1631
1632 type Request = crate::wire::DeviceWriteRequest<'static>;
1633 }
1634
1635 impl ::fidl_next::TwoWayMethod for Write {
1636 type Response = ::fidl_next::wire::Result<
1637 'static,
1638 crate::wire::DeviceWriteResponse,
1639 ::fidl_next::wire::fuchsia::Status,
1640 >;
1641 }
1642
1643 impl<___R> ::fidl_next::Respond<___R> for Write {
1644 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
1645
1646 fn respond(response: ___R) -> Self::Output {
1647 ::core::result::Result::Ok(response)
1648 }
1649 }
1650
1651 impl<___R> ::fidl_next::RespondErr<___R> for Write {
1652 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
1653
1654 fn respond_err(response: ___R) -> Self::Output {
1655 ::core::result::Result::Err(response)
1656 }
1657 }
1658
1659 pub struct CancelAll;
1660
1661 impl ::fidl_next::Method for CancelAll {
1662 const ORDINAL: u64 = 7893637289785611908;
1663 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1664 ::fidl_next::protocol::Flexibility::Flexible;
1665
1666 type Protocol = crate::Device;
1667
1668 type Request = ::fidl_next::wire::EmptyMessageBody;
1669 }
1670
1671 impl ::fidl_next::TwoWayMethod for CancelAll {
1672 type Response = ::fidl_next::wire::Flexible<'static, crate::wire::DeviceCancelAllResponse>;
1673 }
1674
1675 impl<___R> ::fidl_next::Respond<___R> for CancelAll {
1676 type Output = ::fidl_next::Flexible<___R>;
1677
1678 fn respond(response: ___R) -> Self::Output {
1679 ::fidl_next::Flexible(response)
1680 }
1681 }
1682
1683 mod ___detail {
1684 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Device
1685 where
1686 ___T: ::fidl_next::Transport,
1687 {
1688 type Client = DeviceClient<___T>;
1689 type Server = DeviceServer<___T>;
1690 }
1691
1692 #[repr(transparent)]
1694 pub struct DeviceClient<___T: ::fidl_next::Transport> {
1695 #[allow(dead_code)]
1696 client: ::fidl_next::protocol::Client<___T>,
1697 }
1698
1699 impl<___T> DeviceClient<___T>
1700 where
1701 ___T: ::fidl_next::Transport,
1702 {
1703 pub fn get_info(&self) -> ::fidl_next::TwoWayFuture<'_, super::GetInfo, ___T> {
1704 ::fidl_next::TwoWayFuture::from_untyped(
1705 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
1706 4293470822215791047,
1707 <super::GetInfo as ::fidl_next::Method>::FLEXIBILITY,
1708 (),
1709 ),
1710 )
1711 }
1712
1713 #[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"]
1714 pub fn config(
1715 &self,
1716
1717 baud_rate: impl ::fidl_next::Encode<
1718 ::fidl_next::wire::Uint32,
1719 <___T as ::fidl_next::Transport>::SendBuffer,
1720 >,
1721
1722 flags: impl ::fidl_next::Encode<
1723 ::fidl_next::wire::Uint32,
1724 <___T as ::fidl_next::Transport>::SendBuffer,
1725 >,
1726 ) -> ::fidl_next::TwoWayFuture<'_, super::Config, ___T>
1727 where
1728 <___T as ::fidl_next::Transport>::SendBuffer:
1729 ::fidl_next::encoder::InternalHandleEncoder,
1730 {
1731 self.config_with(crate::generic::DeviceConfigRequest { baud_rate, flags })
1732 }
1733
1734 #[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"]
1735 pub fn config_with<___R>(
1736 &self,
1737 request: ___R,
1738 ) -> ::fidl_next::TwoWayFuture<'_, super::Config, ___T>
1739 where
1740 ___R: ::fidl_next::Encode<
1741 crate::wire::DeviceConfigRequest,
1742 <___T as ::fidl_next::Transport>::SendBuffer,
1743 >,
1744 {
1745 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1746 9101333665396964949,
1747 <super::Config as ::fidl_next::Method>::FLEXIBILITY,
1748 request,
1749 ))
1750 }
1751
1752 #[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"]
1753 pub fn enable(
1754 &self,
1755
1756 enable: impl ::fidl_next::Encode<bool, <___T as ::fidl_next::Transport>::SendBuffer>,
1757 ) -> ::fidl_next::TwoWayFuture<'_, super::Enable, ___T>
1758 where
1759 <___T as ::fidl_next::Transport>::SendBuffer:
1760 ::fidl_next::encoder::InternalHandleEncoder,
1761 {
1762 self.enable_with(crate::generic::DeviceEnableRequest { enable })
1763 }
1764
1765 #[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"]
1766 pub fn enable_with<___R>(
1767 &self,
1768 request: ___R,
1769 ) -> ::fidl_next::TwoWayFuture<'_, super::Enable, ___T>
1770 where
1771 ___R: ::fidl_next::Encode<
1772 crate::wire::DeviceEnableRequest,
1773 <___T as ::fidl_next::Transport>::SendBuffer,
1774 >,
1775 {
1776 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1777 8261907286572550878,
1778 <super::Enable as ::fidl_next::Method>::FLEXIBILITY,
1779 request,
1780 ))
1781 }
1782
1783 #[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"]
1784 pub fn read(&self) -> ::fidl_next::TwoWayFuture<'_, super::Read, ___T> {
1785 ::fidl_next::TwoWayFuture::from_untyped(
1786 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
1787 297271503544427203,
1788 <super::Read as ::fidl_next::Method>::FLEXIBILITY,
1789 (),
1790 ),
1791 )
1792 }
1793
1794 #[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"]
1795 pub fn write(
1796 &self,
1797
1798 data: impl ::fidl_next::Encode<
1799 ::fidl_next::wire::Vector<'static, u8>,
1800 <___T as ::fidl_next::Transport>::SendBuffer,
1801 >,
1802 ) -> ::fidl_next::TwoWayFuture<'_, super::Write, ___T>
1803 where
1804 <___T as ::fidl_next::Transport>::SendBuffer:
1805 ::fidl_next::encoder::InternalHandleEncoder,
1806 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
1807 {
1808 self.write_with(crate::generic::DeviceWriteRequest { data })
1809 }
1810
1811 #[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"]
1812 pub fn write_with<___R>(
1813 &self,
1814 request: ___R,
1815 ) -> ::fidl_next::TwoWayFuture<'_, super::Write, ___T>
1816 where
1817 ___R: ::fidl_next::Encode<
1818 crate::wire::DeviceWriteRequest<'static>,
1819 <___T as ::fidl_next::Transport>::SendBuffer,
1820 >,
1821 {
1822 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1823 178921085719362274,
1824 <super::Write as ::fidl_next::Method>::FLEXIBILITY,
1825 request,
1826 ))
1827 }
1828
1829 #[doc = " Immediately cancels all outstanding asynchronous I/O\n"]
1830 pub fn cancel_all(&self) -> ::fidl_next::TwoWayFuture<'_, super::CancelAll, ___T> {
1831 ::fidl_next::TwoWayFuture::from_untyped(
1832 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
1833 7893637289785611908,
1834 <super::CancelAll as ::fidl_next::Method>::FLEXIBILITY,
1835 (),
1836 ),
1837 )
1838 }
1839 }
1840
1841 #[repr(transparent)]
1843 pub struct DeviceServer<___T: ::fidl_next::Transport> {
1844 server: ::fidl_next::protocol::Server<___T>,
1845 }
1846
1847 impl<___T> DeviceServer<___T> where ___T: ::fidl_next::Transport {}
1848 }
1849}
1850
1851#[diagnostic::on_unimplemented(
1852 note = "If {Self} implements the non-local DeviceClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
1853)]
1854
1855pub trait DeviceLocalClientHandler<
1859 #[cfg(feature = "driver")] ___T: ::fidl_next::Transport = ::fdf_fidl::DriverChannel,
1860 #[cfg(not(feature = "driver"))] ___T: ::fidl_next::Transport,
1861>
1862{
1863 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
1864 ::core::future::ready(())
1865 }
1866}
1867
1868impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Device
1869where
1870 ___H: DeviceLocalClientHandler<___T>,
1871 ___T: ::fidl_next::Transport,
1872{
1873 async fn on_event(
1874 handler: &mut ___H,
1875 mut message: ::fidl_next::Message<___T>,
1876 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1877 match *message.header().ordinal {
1878 ordinal => {
1879 handler.on_unknown_interaction(ordinal).await;
1880 if ::core::matches!(
1881 message.header().flexibility(),
1882 ::fidl_next::protocol::Flexibility::Strict
1883 ) {
1884 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1885 } else {
1886 Ok(())
1887 }
1888 }
1889 }
1890 }
1891}
1892
1893#[diagnostic::on_unimplemented(
1894 note = "If {Self} implements the non-local DeviceServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
1895)]
1896
1897pub trait DeviceLocalServerHandler<
1901 #[cfg(feature = "driver")] ___T: ::fidl_next::Transport = ::fdf_fidl::DriverChannel,
1902 #[cfg(not(feature = "driver"))] ___T: ::fidl_next::Transport,
1903>
1904{
1905 fn get_info(
1906 &mut self,
1907
1908 responder: ::fidl_next::Responder<device::GetInfo, ___T>,
1909 ) -> impl ::core::future::Future<Output = ()>;
1910
1911 #[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"]
1912 fn config(
1913 &mut self,
1914
1915 request: ::fidl_next::Request<device::Config, ___T>,
1916
1917 responder: ::fidl_next::Responder<device::Config, ___T>,
1918 ) -> impl ::core::future::Future<Output = ()>;
1919
1920 #[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"]
1921 fn enable(
1922 &mut self,
1923
1924 request: ::fidl_next::Request<device::Enable, ___T>,
1925
1926 responder: ::fidl_next::Responder<device::Enable, ___T>,
1927 ) -> impl ::core::future::Future<Output = ()>;
1928
1929 #[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"]
1930 fn read(
1931 &mut self,
1932
1933 responder: ::fidl_next::Responder<device::Read, ___T>,
1934 ) -> impl ::core::future::Future<Output = ()>;
1935
1936 #[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"]
1937 fn write(
1938 &mut self,
1939
1940 request: ::fidl_next::Request<device::Write, ___T>,
1941
1942 responder: ::fidl_next::Responder<device::Write, ___T>,
1943 ) -> impl ::core::future::Future<Output = ()>;
1944
1945 #[doc = " Immediately cancels all outstanding asynchronous I/O\n"]
1946 fn cancel_all(
1947 &mut self,
1948
1949 responder: ::fidl_next::Responder<device::CancelAll, ___T>,
1950 ) -> impl ::core::future::Future<Output = ()>;
1951
1952 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
1953 ::core::future::ready(())
1954 }
1955}
1956
1957impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Device
1958where
1959 ___H: DeviceLocalServerHandler<___T>,
1960 ___T: ::fidl_next::Transport,
1961 for<'de> crate::wire::DeviceConfigRequest: ::fidl_next::Decode<
1962 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1963 Constraint = (),
1964 >,
1965 for<'de> crate::wire::DeviceEnableRequest: ::fidl_next::Decode<
1966 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1967 Constraint = (),
1968 >,
1969 for<'de> crate::wire::DeviceWriteRequest<'de>: ::fidl_next::Decode<
1970 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1971 Constraint = (),
1972 >,
1973{
1974 async fn on_one_way(
1975 handler: &mut ___H,
1976 mut message: ::fidl_next::Message<___T>,
1977 ) -> ::core::result::Result<
1978 (),
1979 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1980 > {
1981 match *message.header().ordinal {
1982 ordinal => {
1983 handler.on_unknown_interaction(ordinal).await;
1984 if ::core::matches!(
1985 message.header().flexibility(),
1986 ::fidl_next::protocol::Flexibility::Strict
1987 ) {
1988 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1989 } else {
1990 Ok(())
1991 }
1992 }
1993 }
1994 }
1995
1996 async fn on_two_way(
1997 handler: &mut ___H,
1998 mut message: ::fidl_next::Message<___T>,
1999 responder: ::fidl_next::protocol::Responder<___T>,
2000 ) -> ::core::result::Result<
2001 (),
2002 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
2003 > {
2004 match *message.header().ordinal {
2005 4293470822215791047 => {
2006 let responder = ::fidl_next::Responder::from_untyped(responder);
2007
2008 handler.get_info(responder).await;
2009 Ok(())
2010 }
2011
2012 9101333665396964949 => {
2013 let responder = ::fidl_next::Responder::from_untyped(responder);
2014
2015 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2016 Ok(decoded) => {
2017 handler
2018 .config(::fidl_next::Request::from_decoded(decoded), responder)
2019 .await;
2020 Ok(())
2021 }
2022 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2023 ordinal: 9101333665396964949,
2024 error,
2025 }),
2026 }
2027 }
2028
2029 8261907286572550878 => {
2030 let responder = ::fidl_next::Responder::from_untyped(responder);
2031
2032 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2033 Ok(decoded) => {
2034 handler
2035 .enable(::fidl_next::Request::from_decoded(decoded), responder)
2036 .await;
2037 Ok(())
2038 }
2039 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2040 ordinal: 8261907286572550878,
2041 error,
2042 }),
2043 }
2044 }
2045
2046 297271503544427203 => {
2047 let responder = ::fidl_next::Responder::from_untyped(responder);
2048
2049 handler.read(responder).await;
2050 Ok(())
2051 }
2052
2053 178921085719362274 => {
2054 let responder = ::fidl_next::Responder::from_untyped(responder);
2055
2056 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2057 Ok(decoded) => {
2058 handler.write(::fidl_next::Request::from_decoded(decoded), responder).await;
2059 Ok(())
2060 }
2061 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2062 ordinal: 178921085719362274,
2063 error,
2064 }),
2065 }
2066 }
2067
2068 7893637289785611908 => {
2069 let responder = ::fidl_next::Responder::from_untyped(responder);
2070
2071 handler.cancel_all(responder).await;
2072 Ok(())
2073 }
2074
2075 ordinal => {
2076 handler.on_unknown_interaction(ordinal).await;
2077 if ::core::matches!(
2078 message.header().flexibility(),
2079 ::fidl_next::protocol::Flexibility::Strict
2080 ) {
2081 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2082 } else {
2083 responder
2084 .respond_framework_error(
2085 ordinal,
2086 ::fidl_next::FrameworkError::UnknownMethod,
2087 )
2088 .expect("encoding a framework error should never fail")
2089 .await?;
2090 Ok(())
2091 }
2092 }
2093 }
2094 }
2095}
2096
2097pub trait DeviceClientHandler<
2101 #[cfg(feature = "driver")] ___T: ::fidl_next::Transport = ::fdf_fidl::DriverChannel,
2102 #[cfg(not(feature = "driver"))] ___T: ::fidl_next::Transport,
2103>
2104{
2105 fn on_unknown_interaction(
2106 &mut self,
2107 ordinal: u64,
2108 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
2109 ::core::future::ready(())
2110 }
2111}
2112
2113impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Device
2114where
2115 ___H: DeviceClientHandler<___T> + ::core::marker::Send,
2116 ___T: ::fidl_next::Transport,
2117{
2118 async fn on_event(
2119 handler: &mut ___H,
2120 mut message: ::fidl_next::Message<___T>,
2121 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
2122 match *message.header().ordinal {
2123 ordinal => {
2124 handler.on_unknown_interaction(ordinal).await;
2125 if ::core::matches!(
2126 message.header().flexibility(),
2127 ::fidl_next::protocol::Flexibility::Strict
2128 ) {
2129 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2130 } else {
2131 Ok(())
2132 }
2133 }
2134 }
2135 }
2136}
2137
2138pub trait DeviceServerHandler<
2142 #[cfg(feature = "driver")] ___T: ::fidl_next::Transport = ::fdf_fidl::DriverChannel,
2143 #[cfg(not(feature = "driver"))] ___T: ::fidl_next::Transport,
2144>
2145{
2146 fn get_info(
2147 &mut self,
2148
2149 responder: ::fidl_next::Responder<device::GetInfo, ___T>,
2150 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2151
2152 #[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"]
2153 fn config(
2154 &mut self,
2155
2156 request: ::fidl_next::Request<device::Config, ___T>,
2157
2158 responder: ::fidl_next::Responder<device::Config, ___T>,
2159 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2160
2161 #[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"]
2162 fn enable(
2163 &mut self,
2164
2165 request: ::fidl_next::Request<device::Enable, ___T>,
2166
2167 responder: ::fidl_next::Responder<device::Enable, ___T>,
2168 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2169
2170 #[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"]
2171 fn read(
2172 &mut self,
2173
2174 responder: ::fidl_next::Responder<device::Read, ___T>,
2175 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2176
2177 #[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"]
2178 fn write(
2179 &mut self,
2180
2181 request: ::fidl_next::Request<device::Write, ___T>,
2182
2183 responder: ::fidl_next::Responder<device::Write, ___T>,
2184 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2185
2186 #[doc = " Immediately cancels all outstanding asynchronous I/O\n"]
2187 fn cancel_all(
2188 &mut self,
2189
2190 responder: ::fidl_next::Responder<device::CancelAll, ___T>,
2191 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2192
2193 fn on_unknown_interaction(
2194 &mut self,
2195 ordinal: u64,
2196 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
2197 ::core::future::ready(())
2198 }
2199}
2200
2201impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Device
2202where
2203 ___H: DeviceServerHandler<___T> + ::core::marker::Send,
2204 ___T: ::fidl_next::Transport,
2205 for<'de> crate::wire::DeviceConfigRequest: ::fidl_next::Decode<
2206 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2207 Constraint = (),
2208 >,
2209 for<'de> crate::wire::DeviceEnableRequest: ::fidl_next::Decode<
2210 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2211 Constraint = (),
2212 >,
2213 for<'de> crate::wire::DeviceWriteRequest<'de>: ::fidl_next::Decode<
2214 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2215 Constraint = (),
2216 >,
2217{
2218 async fn on_one_way(
2219 handler: &mut ___H,
2220 mut message: ::fidl_next::Message<___T>,
2221 ) -> ::core::result::Result<
2222 (),
2223 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
2224 > {
2225 match *message.header().ordinal {
2226 ordinal => {
2227 handler.on_unknown_interaction(ordinal).await;
2228 if ::core::matches!(
2229 message.header().flexibility(),
2230 ::fidl_next::protocol::Flexibility::Strict
2231 ) {
2232 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2233 } else {
2234 Ok(())
2235 }
2236 }
2237 }
2238 }
2239
2240 async fn on_two_way(
2241 handler: &mut ___H,
2242 mut message: ::fidl_next::Message<___T>,
2243 responder: ::fidl_next::protocol::Responder<___T>,
2244 ) -> ::core::result::Result<
2245 (),
2246 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
2247 > {
2248 match *message.header().ordinal {
2249 4293470822215791047 => {
2250 let responder = ::fidl_next::Responder::from_untyped(responder);
2251
2252 handler.get_info(responder).await;
2253 Ok(())
2254 }
2255
2256 9101333665396964949 => {
2257 let responder = ::fidl_next::Responder::from_untyped(responder);
2258
2259 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2260 Ok(decoded) => {
2261 handler
2262 .config(::fidl_next::Request::from_decoded(decoded), responder)
2263 .await;
2264 Ok(())
2265 }
2266 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2267 ordinal: 9101333665396964949,
2268 error,
2269 }),
2270 }
2271 }
2272
2273 8261907286572550878 => {
2274 let responder = ::fidl_next::Responder::from_untyped(responder);
2275
2276 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2277 Ok(decoded) => {
2278 handler
2279 .enable(::fidl_next::Request::from_decoded(decoded), responder)
2280 .await;
2281 Ok(())
2282 }
2283 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2284 ordinal: 8261907286572550878,
2285 error,
2286 }),
2287 }
2288 }
2289
2290 297271503544427203 => {
2291 let responder = ::fidl_next::Responder::from_untyped(responder);
2292
2293 handler.read(responder).await;
2294 Ok(())
2295 }
2296
2297 178921085719362274 => {
2298 let responder = ::fidl_next::Responder::from_untyped(responder);
2299
2300 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2301 Ok(decoded) => {
2302 handler.write(::fidl_next::Request::from_decoded(decoded), responder).await;
2303 Ok(())
2304 }
2305 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2306 ordinal: 178921085719362274,
2307 error,
2308 }),
2309 }
2310 }
2311
2312 7893637289785611908 => {
2313 let responder = ::fidl_next::Responder::from_untyped(responder);
2314
2315 handler.cancel_all(responder).await;
2316 Ok(())
2317 }
2318
2319 ordinal => {
2320 handler.on_unknown_interaction(ordinal).await;
2321 if ::core::matches!(
2322 message.header().flexibility(),
2323 ::fidl_next::protocol::Flexibility::Strict
2324 ) {
2325 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2326 } else {
2327 responder
2328 .respond_framework_error(
2329 ordinal,
2330 ::fidl_next::FrameworkError::UnknownMethod,
2331 )
2332 .expect("encoding a framework error should never fail")
2333 .await?;
2334 Ok(())
2335 }
2336 }
2337 }
2338 }
2339}
2340
2341impl<___T> DeviceClientHandler<___T> for ::fidl_next::IgnoreEvents
2342where
2343 ___T: ::fidl_next::Transport,
2344{
2345 async fn on_unknown_interaction(&mut self, _: u64) {}
2346}
2347
2348impl<___H, ___T> DeviceLocalClientHandler<___T> for ::fidl_next::Local<___H>
2349where
2350 ___H: DeviceClientHandler<___T>,
2351 ___T: ::fidl_next::Transport,
2352{
2353 async fn on_unknown_interaction(&mut self, ordinal: u64) {
2354 ___H::on_unknown_interaction(&mut self.0, ordinal).await
2355 }
2356}
2357
2358impl<___H, ___T> DeviceLocalServerHandler<___T> for ::fidl_next::Local<___H>
2359where
2360 ___H: DeviceServerHandler<___T>,
2361 ___T: ::fidl_next::Transport,
2362{
2363 async fn get_info(&mut self, responder: ::fidl_next::Responder<device::GetInfo, ___T>) {
2364 ___H::get_info(&mut self.0, responder).await
2365 }
2366
2367 async fn config(
2368 &mut self,
2369
2370 request: ::fidl_next::Request<device::Config, ___T>,
2371
2372 responder: ::fidl_next::Responder<device::Config, ___T>,
2373 ) {
2374 ___H::config(&mut self.0, request, responder).await
2375 }
2376
2377 async fn enable(
2378 &mut self,
2379
2380 request: ::fidl_next::Request<device::Enable, ___T>,
2381
2382 responder: ::fidl_next::Responder<device::Enable, ___T>,
2383 ) {
2384 ___H::enable(&mut self.0, request, responder).await
2385 }
2386
2387 async fn read(&mut self, responder: ::fidl_next::Responder<device::Read, ___T>) {
2388 ___H::read(&mut self.0, responder).await
2389 }
2390
2391 async fn write(
2392 &mut self,
2393
2394 request: ::fidl_next::Request<device::Write, ___T>,
2395
2396 responder: ::fidl_next::Responder<device::Write, ___T>,
2397 ) {
2398 ___H::write(&mut self.0, request, responder).await
2399 }
2400
2401 async fn cancel_all(&mut self, responder: ::fidl_next::Responder<device::CancelAll, ___T>) {
2402 ___H::cancel_all(&mut self.0, responder).await
2403 }
2404
2405 async fn on_unknown_interaction(&mut self, ordinal: u64) {
2406 ___H::on_unknown_interaction(&mut self.0, ordinal).await
2407 }
2408}
2409
2410pub const SERIAL_DATA_BITS_5: u32 = 0 as u32;
2411
2412pub const SERIAL_DATA_BITS_6: u32 = 1 as u32;
2413
2414pub const SERIAL_DATA_BITS_7: u32 = 2 as u32;
2415
2416pub const SERIAL_DATA_BITS_8: u32 = 3 as u32;
2417
2418pub const SERIAL_DATA_BITS_MASK: u32 = 3 as u32;
2419
2420pub const SERIAL_FLOW_CTRL_CTS_RTS: u32 = 32 as u32;
2421
2422pub const SERIAL_FLOW_CTRL_MASK: u32 = 32 as u32;
2423
2424pub const SERIAL_FLOW_CTRL_NONE: u32 = 0 as u32;
2425
2426pub const SERIAL_PARITY_EVEN: u32 = 8 as u32;
2427
2428pub const SERIAL_PARITY_MASK: u32 = 24 as u32;
2429
2430pub const SERIAL_PARITY_NONE: u32 = 0 as u32;
2431
2432pub const SERIAL_PARITY_ODD: u32 = 16 as u32;
2433
2434pub const SERIAL_SET_BAUD_RATE_ONLY: u32 = 2147483648 as u32;
2435
2436pub const SERIAL_STOP_BITS_1: u32 = 0 as u32;
2437
2438pub const SERIAL_STOP_BITS_2: u32 = 4 as u32;
2439
2440pub const SERIAL_STOP_BITS_MASK: u32 = 4 as u32;