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