1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11pub const GAUGE_STATISTIC_MAX_LENGTH: u8 = 5;
12
13pub const MAX_DRIVER_SPECIFIC_COUNTERS: u32 = 127;
14
15pub const MAX_DRIVER_SPECIFIC_GAUGES: u32 = 127;
16
17pub const MAX_HISTOGRAMS_PER_TYPE: u8 = 8;
21
22pub const MAX_NOISE_FLOOR_SAMPLES: u8 = 255;
27
28pub const MAX_RSSI_SAMPLES: u8 = 255;
30
31pub const MAX_RX_RATE_INDEX_SAMPLES: u8 = 196;
33
34pub const MAX_SNR_SAMPLES: u16 = 256;
36
37pub const STAT_NAME_MAX_LENGTH: u8 = 127;
38
39#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
41#[repr(u8)]
42pub enum AntennaFreq {
43 Antenna2G = 1,
45 Antenna5G = 2,
47}
48
49impl AntennaFreq {
50 #[inline]
51 pub fn from_primitive(prim: u8) -> Option<Self> {
52 match prim {
53 1 => Some(Self::Antenna2G),
54 2 => Some(Self::Antenna5G),
55 _ => None,
56 }
57 }
58
59 #[inline]
60 pub const fn into_primitive(self) -> u8 {
61 self as u8
62 }
63
64 #[deprecated = "Strict enums should not use `is_unknown`"]
65 #[inline]
66 pub fn is_unknown(&self) -> bool {
67 false
68 }
69}
70
71#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
73pub enum GaugeStatistic {
74 Min,
75 Max,
76 Sum,
77 Last,
78 Mean,
79 #[doc(hidden)]
80 __SourceBreaking {
81 unknown_ordinal: u8,
82 },
83}
84
85#[macro_export]
87macro_rules! GaugeStatisticUnknown {
88 () => {
89 _
90 };
91}
92
93impl GaugeStatistic {
94 #[inline]
95 pub fn from_primitive(prim: u8) -> Option<Self> {
96 match prim {
97 1 => Some(Self::Min),
98 2 => Some(Self::Max),
99 3 => Some(Self::Sum),
100 4 => Some(Self::Last),
101 5 => Some(Self::Mean),
102 _ => None,
103 }
104 }
105
106 #[inline]
107 pub fn from_primitive_allow_unknown(prim: u8) -> Self {
108 match prim {
109 1 => Self::Min,
110 2 => Self::Max,
111 3 => Self::Sum,
112 4 => Self::Last,
113 5 => Self::Mean,
114 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
115 }
116 }
117
118 #[inline]
119 pub fn unknown() -> Self {
120 Self::__SourceBreaking { unknown_ordinal: 0xff }
121 }
122
123 #[inline]
124 pub const fn into_primitive(self) -> u8 {
125 match self {
126 Self::Min => 1,
127 Self::Max => 2,
128 Self::Sum => 3,
129 Self::Last => 4,
130 Self::Mean => 5,
131 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
132 }
133 }
134
135 #[inline]
136 pub fn is_unknown(&self) -> bool {
137 match self {
138 Self::__SourceBreaking { unknown_ordinal: _ } => true,
139 _ => false,
140 }
141 }
142}
143
144#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
147#[repr(u8)]
148pub enum HistScope {
149 Station = 1,
150 PerAntenna = 2,
151}
152
153impl HistScope {
154 #[inline]
155 pub fn from_primitive(prim: u8) -> Option<Self> {
156 match prim {
157 1 => Some(Self::Station),
158 2 => Some(Self::PerAntenna),
159 _ => None,
160 }
161 }
162
163 #[inline]
164 pub const fn into_primitive(self) -> u8 {
165 self as u8
166 }
167
168 #[deprecated = "Strict enums should not use `is_unknown`"]
169 #[inline]
170 pub fn is_unknown(&self) -> bool {
171 false
172 }
173}
174
175#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
177pub struct AntennaId {
178 pub freq: AntennaFreq,
179 pub index: u8,
181}
182
183impl fidl::Persistable for AntennaId {}
184
185#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
187#[repr(C)]
188pub struct HistBucket {
189 pub bucket_index: u16,
192 pub num_samples: u64,
194}
195
196impl fidl::Persistable for HistBucket {}
197
198#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
200pub struct NoiseFloorHistogram {
201 pub hist_scope: HistScope,
202 pub antenna_id: Option<Box<AntennaId>>,
204 pub noise_floor_samples: Vec<HistBucket>,
209 pub invalid_samples: u64,
211}
212
213impl fidl::Persistable for NoiseFloorHistogram {}
214
215#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
217pub struct RssiHistogram {
218 pub hist_scope: HistScope,
219 pub antenna_id: Option<Box<AntennaId>>,
221 pub rssi_samples: Vec<HistBucket>,
226 pub invalid_samples: u64,
228}
229
230impl fidl::Persistable for RssiHistogram {}
231
232#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
234pub struct RxRateIndexHistogram {
235 pub hist_scope: HistScope,
236 pub antenna_id: Option<Box<AntennaId>>,
238 pub rx_rate_index_samples: Vec<HistBucket>,
263 pub invalid_samples: u64,
265}
266
267impl fidl::Persistable for RxRateIndexHistogram {}
268
269#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
271pub struct SnrHistogram {
272 pub hist_scope: HistScope,
273 pub antenna_id: Option<Box<AntennaId>>,
275 pub snr_samples: Vec<HistBucket>,
280 pub invalid_samples: u64,
282}
283
284impl fidl::Persistable for SnrHistogram {}
285
286#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
287#[repr(C)]
288pub struct UnnamedCounter {
289 pub id: u16,
290 pub count: u64,
291}
292
293impl fidl::Persistable for UnnamedCounter {}
294
295#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
296#[repr(C)]
297pub struct UnnamedGauge {
298 pub id: u16,
299 pub value: i64,
300}
301
302impl fidl::Persistable for UnnamedGauge {}
303
304#[derive(Clone, Debug, Default, PartialEq)]
305pub struct ConnectionStats {
306 pub connection_id: Option<u8>,
316 pub driver_specific_counters: Option<Vec<UnnamedCounter>>,
317 pub driver_specific_gauges: Option<Vec<UnnamedGauge>>,
318 pub rx_unicast_total: Option<u64>,
319 pub rx_unicast_drop: Option<u64>,
320 pub rx_multicast: Option<u64>,
321 pub tx_total: Option<u64>,
322 pub tx_drop: Option<u64>,
323 #[doc(hidden)]
324 pub __source_breaking: fidl::marker::SourceBreaking,
325}
326
327impl fidl::Persistable for ConnectionStats {}
328
329#[derive(Clone, Debug, Default, PartialEq)]
330pub struct IfaceHistogramStats {
331 pub noise_floor_histograms: Option<Vec<NoiseFloorHistogram>>,
333 pub rssi_histograms: Option<Vec<RssiHistogram>>,
335 pub rx_rate_index_histograms: Option<Vec<RxRateIndexHistogram>>,
337 pub snr_histograms: Option<Vec<SnrHistogram>>,
339 #[doc(hidden)]
340 pub __source_breaking: fidl::marker::SourceBreaking,
341}
342
343impl fidl::Persistable for IfaceHistogramStats {}
344
345#[derive(Clone, Debug, Default, PartialEq)]
346pub struct IfaceStats {
347 pub connection_stats: Option<ConnectionStats>,
349 pub driver_specific_counters: Option<Vec<UnnamedCounter>>,
350 pub driver_specific_gauges: Option<Vec<UnnamedGauge>>,
351 #[doc(hidden)]
352 pub __source_breaking: fidl::marker::SourceBreaking,
353}
354
355impl fidl::Persistable for IfaceStats {}
356
357#[derive(Clone, Debug, Default, PartialEq)]
360pub struct InspectCounterConfig {
361 pub counter_id: Option<u16>,
362 pub counter_name: Option<String>,
363 #[doc(hidden)]
364 pub __source_breaking: fidl::marker::SourceBreaking,
365}
366
367impl fidl::Persistable for InspectCounterConfig {}
368
369#[derive(Clone, Debug, Default, PartialEq)]
372pub struct InspectGaugeConfig {
373 pub gauge_id: Option<u16>,
374 pub gauge_name: Option<String>,
375 pub statistics: Option<Vec<GaugeStatistic>>,
377 #[doc(hidden)]
378 pub __source_breaking: fidl::marker::SourceBreaking,
379}
380
381impl fidl::Persistable for InspectGaugeConfig {}
382
383#[derive(Clone, Debug, Default, PartialEq)]
384pub struct TelemetrySupport {
385 pub inspect_counter_configs: Option<Vec<InspectCounterConfig>>,
387 pub inspect_gauge_configs: Option<Vec<InspectGaugeConfig>>,
389 #[doc(hidden)]
390 pub __source_breaking: fidl::marker::SourceBreaking,
391}
392
393impl fidl::Persistable for TelemetrySupport {}
394
395mod internal {
396 use super::*;
397 unsafe impl fidl::encoding::TypeMarker for AntennaFreq {
398 type Owned = Self;
399
400 #[inline(always)]
401 fn inline_align(_context: fidl::encoding::Context) -> usize {
402 std::mem::align_of::<u8>()
403 }
404
405 #[inline(always)]
406 fn inline_size(_context: fidl::encoding::Context) -> usize {
407 std::mem::size_of::<u8>()
408 }
409
410 #[inline(always)]
411 fn encode_is_copy() -> bool {
412 true
413 }
414
415 #[inline(always)]
416 fn decode_is_copy() -> bool {
417 false
418 }
419 }
420
421 impl fidl::encoding::ValueTypeMarker for AntennaFreq {
422 type Borrowed<'a> = Self;
423 #[inline(always)]
424 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
425 *value
426 }
427 }
428
429 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for AntennaFreq {
430 #[inline]
431 unsafe fn encode(
432 self,
433 encoder: &mut fidl::encoding::Encoder<'_, D>,
434 offset: usize,
435 _depth: fidl::encoding::Depth,
436 ) -> fidl::Result<()> {
437 encoder.debug_check_bounds::<Self>(offset);
438 encoder.write_num(self.into_primitive(), offset);
439 Ok(())
440 }
441 }
442
443 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AntennaFreq {
444 #[inline(always)]
445 fn new_empty() -> Self {
446 Self::Antenna2G
447 }
448
449 #[inline]
450 unsafe fn decode(
451 &mut self,
452 decoder: &mut fidl::encoding::Decoder<'_, D>,
453 offset: usize,
454 _depth: fidl::encoding::Depth,
455 ) -> fidl::Result<()> {
456 decoder.debug_check_bounds::<Self>(offset);
457 let prim = decoder.read_num::<u8>(offset);
458
459 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
460 Ok(())
461 }
462 }
463 unsafe impl fidl::encoding::TypeMarker for GaugeStatistic {
464 type Owned = Self;
465
466 #[inline(always)]
467 fn inline_align(_context: fidl::encoding::Context) -> usize {
468 std::mem::align_of::<u8>()
469 }
470
471 #[inline(always)]
472 fn inline_size(_context: fidl::encoding::Context) -> usize {
473 std::mem::size_of::<u8>()
474 }
475
476 #[inline(always)]
477 fn encode_is_copy() -> bool {
478 false
479 }
480
481 #[inline(always)]
482 fn decode_is_copy() -> bool {
483 false
484 }
485 }
486
487 impl fidl::encoding::ValueTypeMarker for GaugeStatistic {
488 type Borrowed<'a> = Self;
489 #[inline(always)]
490 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
491 *value
492 }
493 }
494
495 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for GaugeStatistic {
496 #[inline]
497 unsafe fn encode(
498 self,
499 encoder: &mut fidl::encoding::Encoder<'_, D>,
500 offset: usize,
501 _depth: fidl::encoding::Depth,
502 ) -> fidl::Result<()> {
503 encoder.debug_check_bounds::<Self>(offset);
504 encoder.write_num(self.into_primitive(), offset);
505 Ok(())
506 }
507 }
508
509 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for GaugeStatistic {
510 #[inline(always)]
511 fn new_empty() -> Self {
512 Self::unknown()
513 }
514
515 #[inline]
516 unsafe fn decode(
517 &mut self,
518 decoder: &mut fidl::encoding::Decoder<'_, D>,
519 offset: usize,
520 _depth: fidl::encoding::Depth,
521 ) -> fidl::Result<()> {
522 decoder.debug_check_bounds::<Self>(offset);
523 let prim = decoder.read_num::<u8>(offset);
524
525 *self = Self::from_primitive_allow_unknown(prim);
526 Ok(())
527 }
528 }
529 unsafe impl fidl::encoding::TypeMarker for HistScope {
530 type Owned = Self;
531
532 #[inline(always)]
533 fn inline_align(_context: fidl::encoding::Context) -> usize {
534 std::mem::align_of::<u8>()
535 }
536
537 #[inline(always)]
538 fn inline_size(_context: fidl::encoding::Context) -> usize {
539 std::mem::size_of::<u8>()
540 }
541
542 #[inline(always)]
543 fn encode_is_copy() -> bool {
544 true
545 }
546
547 #[inline(always)]
548 fn decode_is_copy() -> bool {
549 false
550 }
551 }
552
553 impl fidl::encoding::ValueTypeMarker for HistScope {
554 type Borrowed<'a> = Self;
555 #[inline(always)]
556 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
557 *value
558 }
559 }
560
561 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for HistScope {
562 #[inline]
563 unsafe fn encode(
564 self,
565 encoder: &mut fidl::encoding::Encoder<'_, D>,
566 offset: usize,
567 _depth: fidl::encoding::Depth,
568 ) -> fidl::Result<()> {
569 encoder.debug_check_bounds::<Self>(offset);
570 encoder.write_num(self.into_primitive(), offset);
571 Ok(())
572 }
573 }
574
575 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HistScope {
576 #[inline(always)]
577 fn new_empty() -> Self {
578 Self::Station
579 }
580
581 #[inline]
582 unsafe fn decode(
583 &mut self,
584 decoder: &mut fidl::encoding::Decoder<'_, D>,
585 offset: usize,
586 _depth: fidl::encoding::Depth,
587 ) -> fidl::Result<()> {
588 decoder.debug_check_bounds::<Self>(offset);
589 let prim = decoder.read_num::<u8>(offset);
590
591 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
592 Ok(())
593 }
594 }
595
596 impl fidl::encoding::ValueTypeMarker for AntennaId {
597 type Borrowed<'a> = &'a Self;
598 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
599 value
600 }
601 }
602
603 unsafe impl fidl::encoding::TypeMarker for AntennaId {
604 type Owned = Self;
605
606 #[inline(always)]
607 fn inline_align(_context: fidl::encoding::Context) -> usize {
608 1
609 }
610
611 #[inline(always)]
612 fn inline_size(_context: fidl::encoding::Context) -> usize {
613 2
614 }
615 }
616
617 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AntennaId, D>
618 for &AntennaId
619 {
620 #[inline]
621 unsafe fn encode(
622 self,
623 encoder: &mut fidl::encoding::Encoder<'_, D>,
624 offset: usize,
625 _depth: fidl::encoding::Depth,
626 ) -> fidl::Result<()> {
627 encoder.debug_check_bounds::<AntennaId>(offset);
628 fidl::encoding::Encode::<AntennaId, D>::encode(
630 (
631 <AntennaFreq as fidl::encoding::ValueTypeMarker>::borrow(&self.freq),
632 <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.index),
633 ),
634 encoder,
635 offset,
636 _depth,
637 )
638 }
639 }
640 unsafe impl<
641 D: fidl::encoding::ResourceDialect,
642 T0: fidl::encoding::Encode<AntennaFreq, D>,
643 T1: fidl::encoding::Encode<u8, D>,
644 > fidl::encoding::Encode<AntennaId, D> for (T0, T1)
645 {
646 #[inline]
647 unsafe fn encode(
648 self,
649 encoder: &mut fidl::encoding::Encoder<'_, D>,
650 offset: usize,
651 depth: fidl::encoding::Depth,
652 ) -> fidl::Result<()> {
653 encoder.debug_check_bounds::<AntennaId>(offset);
654 self.0.encode(encoder, offset + 0, depth)?;
658 self.1.encode(encoder, offset + 1, depth)?;
659 Ok(())
660 }
661 }
662
663 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AntennaId {
664 #[inline(always)]
665 fn new_empty() -> Self {
666 Self { freq: fidl::new_empty!(AntennaFreq, D), index: fidl::new_empty!(u8, D) }
667 }
668
669 #[inline]
670 unsafe fn decode(
671 &mut self,
672 decoder: &mut fidl::encoding::Decoder<'_, D>,
673 offset: usize,
674 _depth: fidl::encoding::Depth,
675 ) -> fidl::Result<()> {
676 decoder.debug_check_bounds::<Self>(offset);
677 fidl::decode!(AntennaFreq, D, &mut self.freq, decoder, offset + 0, _depth)?;
679 fidl::decode!(u8, D, &mut self.index, decoder, offset + 1, _depth)?;
680 Ok(())
681 }
682 }
683
684 impl fidl::encoding::ValueTypeMarker for HistBucket {
685 type Borrowed<'a> = &'a Self;
686 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
687 value
688 }
689 }
690
691 unsafe impl fidl::encoding::TypeMarker for HistBucket {
692 type Owned = Self;
693
694 #[inline(always)]
695 fn inline_align(_context: fidl::encoding::Context) -> usize {
696 8
697 }
698
699 #[inline(always)]
700 fn inline_size(_context: fidl::encoding::Context) -> usize {
701 16
702 }
703 }
704
705 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HistBucket, D>
706 for &HistBucket
707 {
708 #[inline]
709 unsafe fn encode(
710 self,
711 encoder: &mut fidl::encoding::Encoder<'_, D>,
712 offset: usize,
713 _depth: fidl::encoding::Depth,
714 ) -> fidl::Result<()> {
715 encoder.debug_check_bounds::<HistBucket>(offset);
716 unsafe {
717 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
719 (buf_ptr as *mut HistBucket).write_unaligned((self as *const HistBucket).read());
720 let padding_ptr = buf_ptr.offset(0) as *mut u64;
723 let padding_mask = 0xffffffffffff0000u64;
724 padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
725 }
726 Ok(())
727 }
728 }
729 unsafe impl<
730 D: fidl::encoding::ResourceDialect,
731 T0: fidl::encoding::Encode<u16, D>,
732 T1: fidl::encoding::Encode<u64, D>,
733 > fidl::encoding::Encode<HistBucket, D> for (T0, T1)
734 {
735 #[inline]
736 unsafe fn encode(
737 self,
738 encoder: &mut fidl::encoding::Encoder<'_, D>,
739 offset: usize,
740 depth: fidl::encoding::Depth,
741 ) -> fidl::Result<()> {
742 encoder.debug_check_bounds::<HistBucket>(offset);
743 unsafe {
746 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
747 (ptr as *mut u64).write_unaligned(0);
748 }
749 self.0.encode(encoder, offset + 0, depth)?;
751 self.1.encode(encoder, offset + 8, depth)?;
752 Ok(())
753 }
754 }
755
756 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HistBucket {
757 #[inline(always)]
758 fn new_empty() -> Self {
759 Self { bucket_index: fidl::new_empty!(u16, D), num_samples: fidl::new_empty!(u64, D) }
760 }
761
762 #[inline]
763 unsafe fn decode(
764 &mut self,
765 decoder: &mut fidl::encoding::Decoder<'_, D>,
766 offset: usize,
767 _depth: fidl::encoding::Depth,
768 ) -> fidl::Result<()> {
769 decoder.debug_check_bounds::<Self>(offset);
770 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
771 let ptr = unsafe { buf_ptr.offset(0) };
773 let padval = unsafe { (ptr as *const u64).read_unaligned() };
774 let mask = 0xffffffffffff0000u64;
775 let maskedval = padval & mask;
776 if maskedval != 0 {
777 return Err(fidl::Error::NonZeroPadding {
778 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
779 });
780 }
781 unsafe {
783 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
784 }
785 Ok(())
786 }
787 }
788
789 impl fidl::encoding::ValueTypeMarker for NoiseFloorHistogram {
790 type Borrowed<'a> = &'a Self;
791 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
792 value
793 }
794 }
795
796 unsafe impl fidl::encoding::TypeMarker for NoiseFloorHistogram {
797 type Owned = Self;
798
799 #[inline(always)]
800 fn inline_align(_context: fidl::encoding::Context) -> usize {
801 8
802 }
803
804 #[inline(always)]
805 fn inline_size(_context: fidl::encoding::Context) -> usize {
806 40
807 }
808 }
809
810 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NoiseFloorHistogram, D>
811 for &NoiseFloorHistogram
812 {
813 #[inline]
814 unsafe fn encode(
815 self,
816 encoder: &mut fidl::encoding::Encoder<'_, D>,
817 offset: usize,
818 _depth: fidl::encoding::Depth,
819 ) -> fidl::Result<()> {
820 encoder.debug_check_bounds::<NoiseFloorHistogram>(offset);
821 fidl::encoding::Encode::<NoiseFloorHistogram, D>::encode(
823 (
824 <HistScope as fidl::encoding::ValueTypeMarker>::borrow(&self.hist_scope),
825 <fidl::encoding::Boxed<AntennaId> as fidl::encoding::ValueTypeMarker>::borrow(&self.antenna_id),
826 <fidl::encoding::Vector<HistBucket, 255> as fidl::encoding::ValueTypeMarker>::borrow(&self.noise_floor_samples),
827 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.invalid_samples),
828 ),
829 encoder, offset, _depth
830 )
831 }
832 }
833 unsafe impl<
834 D: fidl::encoding::ResourceDialect,
835 T0: fidl::encoding::Encode<HistScope, D>,
836 T1: fidl::encoding::Encode<fidl::encoding::Boxed<AntennaId>, D>,
837 T2: fidl::encoding::Encode<fidl::encoding::Vector<HistBucket, 255>, D>,
838 T3: fidl::encoding::Encode<u64, D>,
839 > fidl::encoding::Encode<NoiseFloorHistogram, D> for (T0, T1, T2, T3)
840 {
841 #[inline]
842 unsafe fn encode(
843 self,
844 encoder: &mut fidl::encoding::Encoder<'_, D>,
845 offset: usize,
846 depth: fidl::encoding::Depth,
847 ) -> fidl::Result<()> {
848 encoder.debug_check_bounds::<NoiseFloorHistogram>(offset);
849 unsafe {
852 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
853 (ptr as *mut u64).write_unaligned(0);
854 }
855 self.0.encode(encoder, offset + 0, depth)?;
857 self.1.encode(encoder, offset + 8, depth)?;
858 self.2.encode(encoder, offset + 16, depth)?;
859 self.3.encode(encoder, offset + 32, depth)?;
860 Ok(())
861 }
862 }
863
864 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NoiseFloorHistogram {
865 #[inline(always)]
866 fn new_empty() -> Self {
867 Self {
868 hist_scope: fidl::new_empty!(HistScope, D),
869 antenna_id: fidl::new_empty!(fidl::encoding::Boxed<AntennaId>, D),
870 noise_floor_samples: fidl::new_empty!(fidl::encoding::Vector<HistBucket, 255>, D),
871 invalid_samples: fidl::new_empty!(u64, D),
872 }
873 }
874
875 #[inline]
876 unsafe fn decode(
877 &mut self,
878 decoder: &mut fidl::encoding::Decoder<'_, D>,
879 offset: usize,
880 _depth: fidl::encoding::Depth,
881 ) -> fidl::Result<()> {
882 decoder.debug_check_bounds::<Self>(offset);
883 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
885 let padval = unsafe { (ptr as *const u64).read_unaligned() };
886 let mask = 0xffffffffffffff00u64;
887 let maskedval = padval & mask;
888 if maskedval != 0 {
889 return Err(fidl::Error::NonZeroPadding {
890 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
891 });
892 }
893 fidl::decode!(HistScope, D, &mut self.hist_scope, decoder, offset + 0, _depth)?;
894 fidl::decode!(
895 fidl::encoding::Boxed<AntennaId>,
896 D,
897 &mut self.antenna_id,
898 decoder,
899 offset + 8,
900 _depth
901 )?;
902 fidl::decode!(fidl::encoding::Vector<HistBucket, 255>, D, &mut self.noise_floor_samples, decoder, offset + 16, _depth)?;
903 fidl::decode!(u64, D, &mut self.invalid_samples, decoder, offset + 32, _depth)?;
904 Ok(())
905 }
906 }
907
908 impl fidl::encoding::ValueTypeMarker for RssiHistogram {
909 type Borrowed<'a> = &'a Self;
910 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
911 value
912 }
913 }
914
915 unsafe impl fidl::encoding::TypeMarker for RssiHistogram {
916 type Owned = Self;
917
918 #[inline(always)]
919 fn inline_align(_context: fidl::encoding::Context) -> usize {
920 8
921 }
922
923 #[inline(always)]
924 fn inline_size(_context: fidl::encoding::Context) -> usize {
925 40
926 }
927 }
928
929 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RssiHistogram, D>
930 for &RssiHistogram
931 {
932 #[inline]
933 unsafe fn encode(
934 self,
935 encoder: &mut fidl::encoding::Encoder<'_, D>,
936 offset: usize,
937 _depth: fidl::encoding::Depth,
938 ) -> fidl::Result<()> {
939 encoder.debug_check_bounds::<RssiHistogram>(offset);
940 fidl::encoding::Encode::<RssiHistogram, D>::encode(
942 (
943 <HistScope as fidl::encoding::ValueTypeMarker>::borrow(&self.hist_scope),
944 <fidl::encoding::Boxed<AntennaId> as fidl::encoding::ValueTypeMarker>::borrow(&self.antenna_id),
945 <fidl::encoding::Vector<HistBucket, 255> as fidl::encoding::ValueTypeMarker>::borrow(&self.rssi_samples),
946 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.invalid_samples),
947 ),
948 encoder, offset, _depth
949 )
950 }
951 }
952 unsafe impl<
953 D: fidl::encoding::ResourceDialect,
954 T0: fidl::encoding::Encode<HistScope, D>,
955 T1: fidl::encoding::Encode<fidl::encoding::Boxed<AntennaId>, D>,
956 T2: fidl::encoding::Encode<fidl::encoding::Vector<HistBucket, 255>, D>,
957 T3: fidl::encoding::Encode<u64, D>,
958 > fidl::encoding::Encode<RssiHistogram, D> for (T0, T1, T2, T3)
959 {
960 #[inline]
961 unsafe fn encode(
962 self,
963 encoder: &mut fidl::encoding::Encoder<'_, D>,
964 offset: usize,
965 depth: fidl::encoding::Depth,
966 ) -> fidl::Result<()> {
967 encoder.debug_check_bounds::<RssiHistogram>(offset);
968 unsafe {
971 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
972 (ptr as *mut u64).write_unaligned(0);
973 }
974 self.0.encode(encoder, offset + 0, depth)?;
976 self.1.encode(encoder, offset + 8, depth)?;
977 self.2.encode(encoder, offset + 16, depth)?;
978 self.3.encode(encoder, offset + 32, depth)?;
979 Ok(())
980 }
981 }
982
983 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RssiHistogram {
984 #[inline(always)]
985 fn new_empty() -> Self {
986 Self {
987 hist_scope: fidl::new_empty!(HistScope, D),
988 antenna_id: fidl::new_empty!(fidl::encoding::Boxed<AntennaId>, D),
989 rssi_samples: fidl::new_empty!(fidl::encoding::Vector<HistBucket, 255>, D),
990 invalid_samples: fidl::new_empty!(u64, D),
991 }
992 }
993
994 #[inline]
995 unsafe fn decode(
996 &mut self,
997 decoder: &mut fidl::encoding::Decoder<'_, D>,
998 offset: usize,
999 _depth: fidl::encoding::Depth,
1000 ) -> fidl::Result<()> {
1001 decoder.debug_check_bounds::<Self>(offset);
1002 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1004 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1005 let mask = 0xffffffffffffff00u64;
1006 let maskedval = padval & mask;
1007 if maskedval != 0 {
1008 return Err(fidl::Error::NonZeroPadding {
1009 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1010 });
1011 }
1012 fidl::decode!(HistScope, D, &mut self.hist_scope, decoder, offset + 0, _depth)?;
1013 fidl::decode!(
1014 fidl::encoding::Boxed<AntennaId>,
1015 D,
1016 &mut self.antenna_id,
1017 decoder,
1018 offset + 8,
1019 _depth
1020 )?;
1021 fidl::decode!(fidl::encoding::Vector<HistBucket, 255>, D, &mut self.rssi_samples, decoder, offset + 16, _depth)?;
1022 fidl::decode!(u64, D, &mut self.invalid_samples, decoder, offset + 32, _depth)?;
1023 Ok(())
1024 }
1025 }
1026
1027 impl fidl::encoding::ValueTypeMarker for RxRateIndexHistogram {
1028 type Borrowed<'a> = &'a Self;
1029 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1030 value
1031 }
1032 }
1033
1034 unsafe impl fidl::encoding::TypeMarker for RxRateIndexHistogram {
1035 type Owned = Self;
1036
1037 #[inline(always)]
1038 fn inline_align(_context: fidl::encoding::Context) -> usize {
1039 8
1040 }
1041
1042 #[inline(always)]
1043 fn inline_size(_context: fidl::encoding::Context) -> usize {
1044 40
1045 }
1046 }
1047
1048 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RxRateIndexHistogram, D>
1049 for &RxRateIndexHistogram
1050 {
1051 #[inline]
1052 unsafe fn encode(
1053 self,
1054 encoder: &mut fidl::encoding::Encoder<'_, D>,
1055 offset: usize,
1056 _depth: fidl::encoding::Depth,
1057 ) -> fidl::Result<()> {
1058 encoder.debug_check_bounds::<RxRateIndexHistogram>(offset);
1059 fidl::encoding::Encode::<RxRateIndexHistogram, D>::encode(
1061 (
1062 <HistScope as fidl::encoding::ValueTypeMarker>::borrow(&self.hist_scope),
1063 <fidl::encoding::Boxed<AntennaId> as fidl::encoding::ValueTypeMarker>::borrow(&self.antenna_id),
1064 <fidl::encoding::Vector<HistBucket, 196> as fidl::encoding::ValueTypeMarker>::borrow(&self.rx_rate_index_samples),
1065 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.invalid_samples),
1066 ),
1067 encoder, offset, _depth
1068 )
1069 }
1070 }
1071 unsafe impl<
1072 D: fidl::encoding::ResourceDialect,
1073 T0: fidl::encoding::Encode<HistScope, D>,
1074 T1: fidl::encoding::Encode<fidl::encoding::Boxed<AntennaId>, D>,
1075 T2: fidl::encoding::Encode<fidl::encoding::Vector<HistBucket, 196>, D>,
1076 T3: fidl::encoding::Encode<u64, D>,
1077 > fidl::encoding::Encode<RxRateIndexHistogram, D> for (T0, T1, T2, T3)
1078 {
1079 #[inline]
1080 unsafe fn encode(
1081 self,
1082 encoder: &mut fidl::encoding::Encoder<'_, D>,
1083 offset: usize,
1084 depth: fidl::encoding::Depth,
1085 ) -> fidl::Result<()> {
1086 encoder.debug_check_bounds::<RxRateIndexHistogram>(offset);
1087 unsafe {
1090 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1091 (ptr as *mut u64).write_unaligned(0);
1092 }
1093 self.0.encode(encoder, offset + 0, depth)?;
1095 self.1.encode(encoder, offset + 8, depth)?;
1096 self.2.encode(encoder, offset + 16, depth)?;
1097 self.3.encode(encoder, offset + 32, depth)?;
1098 Ok(())
1099 }
1100 }
1101
1102 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RxRateIndexHistogram {
1103 #[inline(always)]
1104 fn new_empty() -> Self {
1105 Self {
1106 hist_scope: fidl::new_empty!(HistScope, D),
1107 antenna_id: fidl::new_empty!(fidl::encoding::Boxed<AntennaId>, D),
1108 rx_rate_index_samples: fidl::new_empty!(fidl::encoding::Vector<HistBucket, 196>, D),
1109 invalid_samples: fidl::new_empty!(u64, D),
1110 }
1111 }
1112
1113 #[inline]
1114 unsafe fn decode(
1115 &mut self,
1116 decoder: &mut fidl::encoding::Decoder<'_, D>,
1117 offset: usize,
1118 _depth: fidl::encoding::Depth,
1119 ) -> fidl::Result<()> {
1120 decoder.debug_check_bounds::<Self>(offset);
1121 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1123 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1124 let mask = 0xffffffffffffff00u64;
1125 let maskedval = padval & mask;
1126 if maskedval != 0 {
1127 return Err(fidl::Error::NonZeroPadding {
1128 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1129 });
1130 }
1131 fidl::decode!(HistScope, D, &mut self.hist_scope, decoder, offset + 0, _depth)?;
1132 fidl::decode!(
1133 fidl::encoding::Boxed<AntennaId>,
1134 D,
1135 &mut self.antenna_id,
1136 decoder,
1137 offset + 8,
1138 _depth
1139 )?;
1140 fidl::decode!(fidl::encoding::Vector<HistBucket, 196>, D, &mut self.rx_rate_index_samples, decoder, offset + 16, _depth)?;
1141 fidl::decode!(u64, D, &mut self.invalid_samples, decoder, offset + 32, _depth)?;
1142 Ok(())
1143 }
1144 }
1145
1146 impl fidl::encoding::ValueTypeMarker for SnrHistogram {
1147 type Borrowed<'a> = &'a Self;
1148 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1149 value
1150 }
1151 }
1152
1153 unsafe impl fidl::encoding::TypeMarker for SnrHistogram {
1154 type Owned = Self;
1155
1156 #[inline(always)]
1157 fn inline_align(_context: fidl::encoding::Context) -> usize {
1158 8
1159 }
1160
1161 #[inline(always)]
1162 fn inline_size(_context: fidl::encoding::Context) -> usize {
1163 40
1164 }
1165 }
1166
1167 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SnrHistogram, D>
1168 for &SnrHistogram
1169 {
1170 #[inline]
1171 unsafe fn encode(
1172 self,
1173 encoder: &mut fidl::encoding::Encoder<'_, D>,
1174 offset: usize,
1175 _depth: fidl::encoding::Depth,
1176 ) -> fidl::Result<()> {
1177 encoder.debug_check_bounds::<SnrHistogram>(offset);
1178 fidl::encoding::Encode::<SnrHistogram, D>::encode(
1180 (
1181 <HistScope as fidl::encoding::ValueTypeMarker>::borrow(&self.hist_scope),
1182 <fidl::encoding::Boxed<AntennaId> as fidl::encoding::ValueTypeMarker>::borrow(&self.antenna_id),
1183 <fidl::encoding::Vector<HistBucket, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.snr_samples),
1184 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.invalid_samples),
1185 ),
1186 encoder, offset, _depth
1187 )
1188 }
1189 }
1190 unsafe impl<
1191 D: fidl::encoding::ResourceDialect,
1192 T0: fidl::encoding::Encode<HistScope, D>,
1193 T1: fidl::encoding::Encode<fidl::encoding::Boxed<AntennaId>, D>,
1194 T2: fidl::encoding::Encode<fidl::encoding::Vector<HistBucket, 256>, D>,
1195 T3: fidl::encoding::Encode<u64, D>,
1196 > fidl::encoding::Encode<SnrHistogram, D> for (T0, T1, T2, T3)
1197 {
1198 #[inline]
1199 unsafe fn encode(
1200 self,
1201 encoder: &mut fidl::encoding::Encoder<'_, D>,
1202 offset: usize,
1203 depth: fidl::encoding::Depth,
1204 ) -> fidl::Result<()> {
1205 encoder.debug_check_bounds::<SnrHistogram>(offset);
1206 unsafe {
1209 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1210 (ptr as *mut u64).write_unaligned(0);
1211 }
1212 self.0.encode(encoder, offset + 0, depth)?;
1214 self.1.encode(encoder, offset + 8, depth)?;
1215 self.2.encode(encoder, offset + 16, depth)?;
1216 self.3.encode(encoder, offset + 32, depth)?;
1217 Ok(())
1218 }
1219 }
1220
1221 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SnrHistogram {
1222 #[inline(always)]
1223 fn new_empty() -> Self {
1224 Self {
1225 hist_scope: fidl::new_empty!(HistScope, D),
1226 antenna_id: fidl::new_empty!(fidl::encoding::Boxed<AntennaId>, D),
1227 snr_samples: fidl::new_empty!(fidl::encoding::Vector<HistBucket, 256>, D),
1228 invalid_samples: fidl::new_empty!(u64, D),
1229 }
1230 }
1231
1232 #[inline]
1233 unsafe fn decode(
1234 &mut self,
1235 decoder: &mut fidl::encoding::Decoder<'_, D>,
1236 offset: usize,
1237 _depth: fidl::encoding::Depth,
1238 ) -> fidl::Result<()> {
1239 decoder.debug_check_bounds::<Self>(offset);
1240 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1242 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1243 let mask = 0xffffffffffffff00u64;
1244 let maskedval = padval & mask;
1245 if maskedval != 0 {
1246 return Err(fidl::Error::NonZeroPadding {
1247 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1248 });
1249 }
1250 fidl::decode!(HistScope, D, &mut self.hist_scope, decoder, offset + 0, _depth)?;
1251 fidl::decode!(
1252 fidl::encoding::Boxed<AntennaId>,
1253 D,
1254 &mut self.antenna_id,
1255 decoder,
1256 offset + 8,
1257 _depth
1258 )?;
1259 fidl::decode!(fidl::encoding::Vector<HistBucket, 256>, D, &mut self.snr_samples, decoder, offset + 16, _depth)?;
1260 fidl::decode!(u64, D, &mut self.invalid_samples, decoder, offset + 32, _depth)?;
1261 Ok(())
1262 }
1263 }
1264
1265 impl fidl::encoding::ValueTypeMarker for UnnamedCounter {
1266 type Borrowed<'a> = &'a Self;
1267 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1268 value
1269 }
1270 }
1271
1272 unsafe impl fidl::encoding::TypeMarker for UnnamedCounter {
1273 type Owned = Self;
1274
1275 #[inline(always)]
1276 fn inline_align(_context: fidl::encoding::Context) -> usize {
1277 8
1278 }
1279
1280 #[inline(always)]
1281 fn inline_size(_context: fidl::encoding::Context) -> usize {
1282 16
1283 }
1284 }
1285
1286 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<UnnamedCounter, D>
1287 for &UnnamedCounter
1288 {
1289 #[inline]
1290 unsafe fn encode(
1291 self,
1292 encoder: &mut fidl::encoding::Encoder<'_, D>,
1293 offset: usize,
1294 _depth: fidl::encoding::Depth,
1295 ) -> fidl::Result<()> {
1296 encoder.debug_check_bounds::<UnnamedCounter>(offset);
1297 unsafe {
1298 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1300 (buf_ptr as *mut UnnamedCounter)
1301 .write_unaligned((self as *const UnnamedCounter).read());
1302 let padding_ptr = buf_ptr.offset(0) as *mut u64;
1305 let padding_mask = 0xffffffffffff0000u64;
1306 padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
1307 }
1308 Ok(())
1309 }
1310 }
1311 unsafe impl<
1312 D: fidl::encoding::ResourceDialect,
1313 T0: fidl::encoding::Encode<u16, D>,
1314 T1: fidl::encoding::Encode<u64, D>,
1315 > fidl::encoding::Encode<UnnamedCounter, D> for (T0, T1)
1316 {
1317 #[inline]
1318 unsafe fn encode(
1319 self,
1320 encoder: &mut fidl::encoding::Encoder<'_, D>,
1321 offset: usize,
1322 depth: fidl::encoding::Depth,
1323 ) -> fidl::Result<()> {
1324 encoder.debug_check_bounds::<UnnamedCounter>(offset);
1325 unsafe {
1328 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1329 (ptr as *mut u64).write_unaligned(0);
1330 }
1331 self.0.encode(encoder, offset + 0, depth)?;
1333 self.1.encode(encoder, offset + 8, depth)?;
1334 Ok(())
1335 }
1336 }
1337
1338 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UnnamedCounter {
1339 #[inline(always)]
1340 fn new_empty() -> Self {
1341 Self { id: fidl::new_empty!(u16, D), count: fidl::new_empty!(u64, D) }
1342 }
1343
1344 #[inline]
1345 unsafe fn decode(
1346 &mut self,
1347 decoder: &mut fidl::encoding::Decoder<'_, D>,
1348 offset: usize,
1349 _depth: fidl::encoding::Depth,
1350 ) -> fidl::Result<()> {
1351 decoder.debug_check_bounds::<Self>(offset);
1352 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1353 let ptr = unsafe { buf_ptr.offset(0) };
1355 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1356 let mask = 0xffffffffffff0000u64;
1357 let maskedval = padval & mask;
1358 if maskedval != 0 {
1359 return Err(fidl::Error::NonZeroPadding {
1360 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1361 });
1362 }
1363 unsafe {
1365 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
1366 }
1367 Ok(())
1368 }
1369 }
1370
1371 impl fidl::encoding::ValueTypeMarker for UnnamedGauge {
1372 type Borrowed<'a> = &'a Self;
1373 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1374 value
1375 }
1376 }
1377
1378 unsafe impl fidl::encoding::TypeMarker for UnnamedGauge {
1379 type Owned = Self;
1380
1381 #[inline(always)]
1382 fn inline_align(_context: fidl::encoding::Context) -> usize {
1383 8
1384 }
1385
1386 #[inline(always)]
1387 fn inline_size(_context: fidl::encoding::Context) -> usize {
1388 16
1389 }
1390 }
1391
1392 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<UnnamedGauge, D>
1393 for &UnnamedGauge
1394 {
1395 #[inline]
1396 unsafe fn encode(
1397 self,
1398 encoder: &mut fidl::encoding::Encoder<'_, D>,
1399 offset: usize,
1400 _depth: fidl::encoding::Depth,
1401 ) -> fidl::Result<()> {
1402 encoder.debug_check_bounds::<UnnamedGauge>(offset);
1403 unsafe {
1404 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1406 (buf_ptr as *mut UnnamedGauge)
1407 .write_unaligned((self as *const UnnamedGauge).read());
1408 let padding_ptr = buf_ptr.offset(0) as *mut u64;
1411 let padding_mask = 0xffffffffffff0000u64;
1412 padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
1413 }
1414 Ok(())
1415 }
1416 }
1417 unsafe impl<
1418 D: fidl::encoding::ResourceDialect,
1419 T0: fidl::encoding::Encode<u16, D>,
1420 T1: fidl::encoding::Encode<i64, D>,
1421 > fidl::encoding::Encode<UnnamedGauge, D> for (T0, T1)
1422 {
1423 #[inline]
1424 unsafe fn encode(
1425 self,
1426 encoder: &mut fidl::encoding::Encoder<'_, D>,
1427 offset: usize,
1428 depth: fidl::encoding::Depth,
1429 ) -> fidl::Result<()> {
1430 encoder.debug_check_bounds::<UnnamedGauge>(offset);
1431 unsafe {
1434 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1435 (ptr as *mut u64).write_unaligned(0);
1436 }
1437 self.0.encode(encoder, offset + 0, depth)?;
1439 self.1.encode(encoder, offset + 8, depth)?;
1440 Ok(())
1441 }
1442 }
1443
1444 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UnnamedGauge {
1445 #[inline(always)]
1446 fn new_empty() -> Self {
1447 Self { id: fidl::new_empty!(u16, D), value: fidl::new_empty!(i64, D) }
1448 }
1449
1450 #[inline]
1451 unsafe fn decode(
1452 &mut self,
1453 decoder: &mut fidl::encoding::Decoder<'_, D>,
1454 offset: usize,
1455 _depth: fidl::encoding::Depth,
1456 ) -> fidl::Result<()> {
1457 decoder.debug_check_bounds::<Self>(offset);
1458 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1459 let ptr = unsafe { buf_ptr.offset(0) };
1461 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1462 let mask = 0xffffffffffff0000u64;
1463 let maskedval = padval & mask;
1464 if maskedval != 0 {
1465 return Err(fidl::Error::NonZeroPadding {
1466 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1467 });
1468 }
1469 unsafe {
1471 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
1472 }
1473 Ok(())
1474 }
1475 }
1476
1477 impl ConnectionStats {
1478 #[inline(always)]
1479 fn max_ordinal_present(&self) -> u64 {
1480 if let Some(_) = self.tx_drop {
1481 return 8;
1482 }
1483 if let Some(_) = self.tx_total {
1484 return 7;
1485 }
1486 if let Some(_) = self.rx_multicast {
1487 return 6;
1488 }
1489 if let Some(_) = self.rx_unicast_drop {
1490 return 5;
1491 }
1492 if let Some(_) = self.rx_unicast_total {
1493 return 4;
1494 }
1495 if let Some(_) = self.driver_specific_gauges {
1496 return 3;
1497 }
1498 if let Some(_) = self.driver_specific_counters {
1499 return 2;
1500 }
1501 if let Some(_) = self.connection_id {
1502 return 1;
1503 }
1504 0
1505 }
1506 }
1507
1508 impl fidl::encoding::ValueTypeMarker for ConnectionStats {
1509 type Borrowed<'a> = &'a Self;
1510 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1511 value
1512 }
1513 }
1514
1515 unsafe impl fidl::encoding::TypeMarker for ConnectionStats {
1516 type Owned = Self;
1517
1518 #[inline(always)]
1519 fn inline_align(_context: fidl::encoding::Context) -> usize {
1520 8
1521 }
1522
1523 #[inline(always)]
1524 fn inline_size(_context: fidl::encoding::Context) -> usize {
1525 16
1526 }
1527 }
1528
1529 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ConnectionStats, D>
1530 for &ConnectionStats
1531 {
1532 unsafe fn encode(
1533 self,
1534 encoder: &mut fidl::encoding::Encoder<'_, D>,
1535 offset: usize,
1536 mut depth: fidl::encoding::Depth,
1537 ) -> fidl::Result<()> {
1538 encoder.debug_check_bounds::<ConnectionStats>(offset);
1539 let max_ordinal: u64 = self.max_ordinal_present();
1541 encoder.write_num(max_ordinal, offset);
1542 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1543 if max_ordinal == 0 {
1545 return Ok(());
1546 }
1547 depth.increment()?;
1548 let envelope_size = 8;
1549 let bytes_len = max_ordinal as usize * envelope_size;
1550 #[allow(unused_variables)]
1551 let offset = encoder.out_of_line_offset(bytes_len);
1552 let mut _prev_end_offset: usize = 0;
1553 if 1 > max_ordinal {
1554 return Ok(());
1555 }
1556
1557 let cur_offset: usize = (1 - 1) * envelope_size;
1560
1561 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1563
1564 fidl::encoding::encode_in_envelope_optional::<u8, D>(
1569 self.connection_id.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
1570 encoder,
1571 offset + cur_offset,
1572 depth,
1573 )?;
1574
1575 _prev_end_offset = cur_offset + envelope_size;
1576 if 2 > max_ordinal {
1577 return Ok(());
1578 }
1579
1580 let cur_offset: usize = (2 - 1) * envelope_size;
1583
1584 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1586
1587 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<UnnamedCounter, 127>, D>(
1592 self.driver_specific_counters.as_ref().map(<fidl::encoding::Vector<UnnamedCounter, 127> as fidl::encoding::ValueTypeMarker>::borrow),
1593 encoder, offset + cur_offset, depth
1594 )?;
1595
1596 _prev_end_offset = cur_offset + envelope_size;
1597 if 3 > max_ordinal {
1598 return Ok(());
1599 }
1600
1601 let cur_offset: usize = (3 - 1) * envelope_size;
1604
1605 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1607
1608 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<UnnamedGauge, 127>, D>(
1613 self.driver_specific_gauges.as_ref().map(<fidl::encoding::Vector<UnnamedGauge, 127> as fidl::encoding::ValueTypeMarker>::borrow),
1614 encoder, offset + cur_offset, depth
1615 )?;
1616
1617 _prev_end_offset = cur_offset + envelope_size;
1618 if 4 > max_ordinal {
1619 return Ok(());
1620 }
1621
1622 let cur_offset: usize = (4 - 1) * envelope_size;
1625
1626 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1628
1629 fidl::encoding::encode_in_envelope_optional::<u64, D>(
1634 self.rx_unicast_total
1635 .as_ref()
1636 .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
1637 encoder,
1638 offset + cur_offset,
1639 depth,
1640 )?;
1641
1642 _prev_end_offset = cur_offset + envelope_size;
1643 if 5 > max_ordinal {
1644 return Ok(());
1645 }
1646
1647 let cur_offset: usize = (5 - 1) * envelope_size;
1650
1651 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1653
1654 fidl::encoding::encode_in_envelope_optional::<u64, D>(
1659 self.rx_unicast_drop.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
1660 encoder,
1661 offset + cur_offset,
1662 depth,
1663 )?;
1664
1665 _prev_end_offset = cur_offset + envelope_size;
1666 if 6 > max_ordinal {
1667 return Ok(());
1668 }
1669
1670 let cur_offset: usize = (6 - 1) * envelope_size;
1673
1674 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1676
1677 fidl::encoding::encode_in_envelope_optional::<u64, D>(
1682 self.rx_multicast.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
1683 encoder,
1684 offset + cur_offset,
1685 depth,
1686 )?;
1687
1688 _prev_end_offset = cur_offset + envelope_size;
1689 if 7 > max_ordinal {
1690 return Ok(());
1691 }
1692
1693 let cur_offset: usize = (7 - 1) * envelope_size;
1696
1697 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1699
1700 fidl::encoding::encode_in_envelope_optional::<u64, D>(
1705 self.tx_total.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
1706 encoder,
1707 offset + cur_offset,
1708 depth,
1709 )?;
1710
1711 _prev_end_offset = cur_offset + envelope_size;
1712 if 8 > max_ordinal {
1713 return Ok(());
1714 }
1715
1716 let cur_offset: usize = (8 - 1) * envelope_size;
1719
1720 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1722
1723 fidl::encoding::encode_in_envelope_optional::<u64, D>(
1728 self.tx_drop.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
1729 encoder,
1730 offset + cur_offset,
1731 depth,
1732 )?;
1733
1734 _prev_end_offset = cur_offset + envelope_size;
1735
1736 Ok(())
1737 }
1738 }
1739
1740 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ConnectionStats {
1741 #[inline(always)]
1742 fn new_empty() -> Self {
1743 Self::default()
1744 }
1745
1746 unsafe fn decode(
1747 &mut self,
1748 decoder: &mut fidl::encoding::Decoder<'_, D>,
1749 offset: usize,
1750 mut depth: fidl::encoding::Depth,
1751 ) -> fidl::Result<()> {
1752 decoder.debug_check_bounds::<Self>(offset);
1753 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1754 None => return Err(fidl::Error::NotNullable),
1755 Some(len) => len,
1756 };
1757 if len == 0 {
1759 return Ok(());
1760 };
1761 depth.increment()?;
1762 let envelope_size = 8;
1763 let bytes_len = len * envelope_size;
1764 let offset = decoder.out_of_line_offset(bytes_len)?;
1765 let mut _next_ordinal_to_read = 0;
1767 let mut next_offset = offset;
1768 let end_offset = offset + bytes_len;
1769 _next_ordinal_to_read += 1;
1770 if next_offset >= end_offset {
1771 return Ok(());
1772 }
1773
1774 while _next_ordinal_to_read < 1 {
1776 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1777 _next_ordinal_to_read += 1;
1778 next_offset += envelope_size;
1779 }
1780
1781 let next_out_of_line = decoder.next_out_of_line();
1782 let handles_before = decoder.remaining_handles();
1783 if let Some((inlined, num_bytes, num_handles)) =
1784 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1785 {
1786 let member_inline_size =
1787 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1788 if inlined != (member_inline_size <= 4) {
1789 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1790 }
1791 let inner_offset;
1792 let mut inner_depth = depth.clone();
1793 if inlined {
1794 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1795 inner_offset = next_offset;
1796 } else {
1797 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1798 inner_depth.increment()?;
1799 }
1800 let val_ref = self.connection_id.get_or_insert_with(|| fidl::new_empty!(u8, D));
1801 fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
1802 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1803 {
1804 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1805 }
1806 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1807 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1808 }
1809 }
1810
1811 next_offset += envelope_size;
1812 _next_ordinal_to_read += 1;
1813 if next_offset >= end_offset {
1814 return Ok(());
1815 }
1816
1817 while _next_ordinal_to_read < 2 {
1819 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1820 _next_ordinal_to_read += 1;
1821 next_offset += envelope_size;
1822 }
1823
1824 let next_out_of_line = decoder.next_out_of_line();
1825 let handles_before = decoder.remaining_handles();
1826 if let Some((inlined, num_bytes, num_handles)) =
1827 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1828 {
1829 let member_inline_size = <fidl::encoding::Vector<UnnamedCounter, 127> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1830 if inlined != (member_inline_size <= 4) {
1831 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1832 }
1833 let inner_offset;
1834 let mut inner_depth = depth.clone();
1835 if inlined {
1836 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1837 inner_offset = next_offset;
1838 } else {
1839 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1840 inner_depth.increment()?;
1841 }
1842 let val_ref = self.driver_specific_counters.get_or_insert_with(
1843 || fidl::new_empty!(fidl::encoding::Vector<UnnamedCounter, 127>, D),
1844 );
1845 fidl::decode!(fidl::encoding::Vector<UnnamedCounter, 127>, D, val_ref, decoder, inner_offset, inner_depth)?;
1846 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1847 {
1848 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1849 }
1850 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1851 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1852 }
1853 }
1854
1855 next_offset += envelope_size;
1856 _next_ordinal_to_read += 1;
1857 if next_offset >= end_offset {
1858 return Ok(());
1859 }
1860
1861 while _next_ordinal_to_read < 3 {
1863 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1864 _next_ordinal_to_read += 1;
1865 next_offset += envelope_size;
1866 }
1867
1868 let next_out_of_line = decoder.next_out_of_line();
1869 let handles_before = decoder.remaining_handles();
1870 if let Some((inlined, num_bytes, num_handles)) =
1871 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1872 {
1873 let member_inline_size = <fidl::encoding::Vector<UnnamedGauge, 127> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1874 if inlined != (member_inline_size <= 4) {
1875 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1876 }
1877 let inner_offset;
1878 let mut inner_depth = depth.clone();
1879 if inlined {
1880 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1881 inner_offset = next_offset;
1882 } else {
1883 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1884 inner_depth.increment()?;
1885 }
1886 let val_ref = self.driver_specific_gauges.get_or_insert_with(
1887 || fidl::new_empty!(fidl::encoding::Vector<UnnamedGauge, 127>, D),
1888 );
1889 fidl::decode!(fidl::encoding::Vector<UnnamedGauge, 127>, D, val_ref, decoder, inner_offset, inner_depth)?;
1890 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1891 {
1892 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1893 }
1894 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1895 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1896 }
1897 }
1898
1899 next_offset += envelope_size;
1900 _next_ordinal_to_read += 1;
1901 if next_offset >= end_offset {
1902 return Ok(());
1903 }
1904
1905 while _next_ordinal_to_read < 4 {
1907 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1908 _next_ordinal_to_read += 1;
1909 next_offset += envelope_size;
1910 }
1911
1912 let next_out_of_line = decoder.next_out_of_line();
1913 let handles_before = decoder.remaining_handles();
1914 if let Some((inlined, num_bytes, num_handles)) =
1915 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1916 {
1917 let member_inline_size =
1918 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1919 if inlined != (member_inline_size <= 4) {
1920 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1921 }
1922 let inner_offset;
1923 let mut inner_depth = depth.clone();
1924 if inlined {
1925 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1926 inner_offset = next_offset;
1927 } else {
1928 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1929 inner_depth.increment()?;
1930 }
1931 let val_ref = self.rx_unicast_total.get_or_insert_with(|| fidl::new_empty!(u64, D));
1932 fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
1933 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1934 {
1935 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1936 }
1937 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1938 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1939 }
1940 }
1941
1942 next_offset += envelope_size;
1943 _next_ordinal_to_read += 1;
1944 if next_offset >= end_offset {
1945 return Ok(());
1946 }
1947
1948 while _next_ordinal_to_read < 5 {
1950 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1951 _next_ordinal_to_read += 1;
1952 next_offset += envelope_size;
1953 }
1954
1955 let next_out_of_line = decoder.next_out_of_line();
1956 let handles_before = decoder.remaining_handles();
1957 if let Some((inlined, num_bytes, num_handles)) =
1958 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1959 {
1960 let member_inline_size =
1961 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1962 if inlined != (member_inline_size <= 4) {
1963 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1964 }
1965 let inner_offset;
1966 let mut inner_depth = depth.clone();
1967 if inlined {
1968 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1969 inner_offset = next_offset;
1970 } else {
1971 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1972 inner_depth.increment()?;
1973 }
1974 let val_ref = self.rx_unicast_drop.get_or_insert_with(|| fidl::new_empty!(u64, D));
1975 fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
1976 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1977 {
1978 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1979 }
1980 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1981 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1982 }
1983 }
1984
1985 next_offset += envelope_size;
1986 _next_ordinal_to_read += 1;
1987 if next_offset >= end_offset {
1988 return Ok(());
1989 }
1990
1991 while _next_ordinal_to_read < 6 {
1993 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1994 _next_ordinal_to_read += 1;
1995 next_offset += envelope_size;
1996 }
1997
1998 let next_out_of_line = decoder.next_out_of_line();
1999 let handles_before = decoder.remaining_handles();
2000 if let Some((inlined, num_bytes, num_handles)) =
2001 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2002 {
2003 let member_inline_size =
2004 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2005 if inlined != (member_inline_size <= 4) {
2006 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2007 }
2008 let inner_offset;
2009 let mut inner_depth = depth.clone();
2010 if inlined {
2011 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2012 inner_offset = next_offset;
2013 } else {
2014 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2015 inner_depth.increment()?;
2016 }
2017 let val_ref = self.rx_multicast.get_or_insert_with(|| fidl::new_empty!(u64, D));
2018 fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
2019 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2020 {
2021 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2022 }
2023 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2024 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2025 }
2026 }
2027
2028 next_offset += envelope_size;
2029 _next_ordinal_to_read += 1;
2030 if next_offset >= end_offset {
2031 return Ok(());
2032 }
2033
2034 while _next_ordinal_to_read < 7 {
2036 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2037 _next_ordinal_to_read += 1;
2038 next_offset += envelope_size;
2039 }
2040
2041 let next_out_of_line = decoder.next_out_of_line();
2042 let handles_before = decoder.remaining_handles();
2043 if let Some((inlined, num_bytes, num_handles)) =
2044 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2045 {
2046 let member_inline_size =
2047 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2048 if inlined != (member_inline_size <= 4) {
2049 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2050 }
2051 let inner_offset;
2052 let mut inner_depth = depth.clone();
2053 if inlined {
2054 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2055 inner_offset = next_offset;
2056 } else {
2057 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2058 inner_depth.increment()?;
2059 }
2060 let val_ref = self.tx_total.get_or_insert_with(|| fidl::new_empty!(u64, D));
2061 fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
2062 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2063 {
2064 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2065 }
2066 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2067 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2068 }
2069 }
2070
2071 next_offset += envelope_size;
2072 _next_ordinal_to_read += 1;
2073 if next_offset >= end_offset {
2074 return Ok(());
2075 }
2076
2077 while _next_ordinal_to_read < 8 {
2079 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2080 _next_ordinal_to_read += 1;
2081 next_offset += envelope_size;
2082 }
2083
2084 let next_out_of_line = decoder.next_out_of_line();
2085 let handles_before = decoder.remaining_handles();
2086 if let Some((inlined, num_bytes, num_handles)) =
2087 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2088 {
2089 let member_inline_size =
2090 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2091 if inlined != (member_inline_size <= 4) {
2092 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2093 }
2094 let inner_offset;
2095 let mut inner_depth = depth.clone();
2096 if inlined {
2097 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2098 inner_offset = next_offset;
2099 } else {
2100 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2101 inner_depth.increment()?;
2102 }
2103 let val_ref = self.tx_drop.get_or_insert_with(|| fidl::new_empty!(u64, D));
2104 fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
2105 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2106 {
2107 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2108 }
2109 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2110 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2111 }
2112 }
2113
2114 next_offset += envelope_size;
2115
2116 while next_offset < end_offset {
2118 _next_ordinal_to_read += 1;
2119 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2120 next_offset += envelope_size;
2121 }
2122
2123 Ok(())
2124 }
2125 }
2126
2127 impl IfaceHistogramStats {
2128 #[inline(always)]
2129 fn max_ordinal_present(&self) -> u64 {
2130 if let Some(_) = self.snr_histograms {
2131 return 4;
2132 }
2133 if let Some(_) = self.rx_rate_index_histograms {
2134 return 3;
2135 }
2136 if let Some(_) = self.rssi_histograms {
2137 return 2;
2138 }
2139 if let Some(_) = self.noise_floor_histograms {
2140 return 1;
2141 }
2142 0
2143 }
2144 }
2145
2146 impl fidl::encoding::ValueTypeMarker for IfaceHistogramStats {
2147 type Borrowed<'a> = &'a Self;
2148 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2149 value
2150 }
2151 }
2152
2153 unsafe impl fidl::encoding::TypeMarker for IfaceHistogramStats {
2154 type Owned = Self;
2155
2156 #[inline(always)]
2157 fn inline_align(_context: fidl::encoding::Context) -> usize {
2158 8
2159 }
2160
2161 #[inline(always)]
2162 fn inline_size(_context: fidl::encoding::Context) -> usize {
2163 16
2164 }
2165 }
2166
2167 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<IfaceHistogramStats, D>
2168 for &IfaceHistogramStats
2169 {
2170 unsafe fn encode(
2171 self,
2172 encoder: &mut fidl::encoding::Encoder<'_, D>,
2173 offset: usize,
2174 mut depth: fidl::encoding::Depth,
2175 ) -> fidl::Result<()> {
2176 encoder.debug_check_bounds::<IfaceHistogramStats>(offset);
2177 let max_ordinal: u64 = self.max_ordinal_present();
2179 encoder.write_num(max_ordinal, offset);
2180 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2181 if max_ordinal == 0 {
2183 return Ok(());
2184 }
2185 depth.increment()?;
2186 let envelope_size = 8;
2187 let bytes_len = max_ordinal as usize * envelope_size;
2188 #[allow(unused_variables)]
2189 let offset = encoder.out_of_line_offset(bytes_len);
2190 let mut _prev_end_offset: usize = 0;
2191 if 1 > max_ordinal {
2192 return Ok(());
2193 }
2194
2195 let cur_offset: usize = (1 - 1) * envelope_size;
2198
2199 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2201
2202 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<NoiseFloorHistogram, 8>, D>(
2207 self.noise_floor_histograms.as_ref().map(<fidl::encoding::Vector<NoiseFloorHistogram, 8> as fidl::encoding::ValueTypeMarker>::borrow),
2208 encoder, offset + cur_offset, depth
2209 )?;
2210
2211 _prev_end_offset = cur_offset + envelope_size;
2212 if 2 > max_ordinal {
2213 return Ok(());
2214 }
2215
2216 let cur_offset: usize = (2 - 1) * envelope_size;
2219
2220 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2222
2223 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<RssiHistogram, 8>, D>(
2228 self.rssi_histograms.as_ref().map(<fidl::encoding::Vector<RssiHistogram, 8> as fidl::encoding::ValueTypeMarker>::borrow),
2229 encoder, offset + cur_offset, depth
2230 )?;
2231
2232 _prev_end_offset = cur_offset + envelope_size;
2233 if 3 > max_ordinal {
2234 return Ok(());
2235 }
2236
2237 let cur_offset: usize = (3 - 1) * envelope_size;
2240
2241 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2243
2244 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<RxRateIndexHistogram, 8>, D>(
2249 self.rx_rate_index_histograms.as_ref().map(<fidl::encoding::Vector<RxRateIndexHistogram, 8> as fidl::encoding::ValueTypeMarker>::borrow),
2250 encoder, offset + cur_offset, depth
2251 )?;
2252
2253 _prev_end_offset = cur_offset + envelope_size;
2254 if 4 > max_ordinal {
2255 return Ok(());
2256 }
2257
2258 let cur_offset: usize = (4 - 1) * envelope_size;
2261
2262 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2264
2265 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SnrHistogram, 8>, D>(
2270 self.snr_histograms.as_ref().map(<fidl::encoding::Vector<SnrHistogram, 8> as fidl::encoding::ValueTypeMarker>::borrow),
2271 encoder, offset + cur_offset, depth
2272 )?;
2273
2274 _prev_end_offset = cur_offset + envelope_size;
2275
2276 Ok(())
2277 }
2278 }
2279
2280 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for IfaceHistogramStats {
2281 #[inline(always)]
2282 fn new_empty() -> Self {
2283 Self::default()
2284 }
2285
2286 unsafe fn decode(
2287 &mut self,
2288 decoder: &mut fidl::encoding::Decoder<'_, D>,
2289 offset: usize,
2290 mut depth: fidl::encoding::Depth,
2291 ) -> fidl::Result<()> {
2292 decoder.debug_check_bounds::<Self>(offset);
2293 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2294 None => return Err(fidl::Error::NotNullable),
2295 Some(len) => len,
2296 };
2297 if len == 0 {
2299 return Ok(());
2300 };
2301 depth.increment()?;
2302 let envelope_size = 8;
2303 let bytes_len = len * envelope_size;
2304 let offset = decoder.out_of_line_offset(bytes_len)?;
2305 let mut _next_ordinal_to_read = 0;
2307 let mut next_offset = offset;
2308 let end_offset = offset + bytes_len;
2309 _next_ordinal_to_read += 1;
2310 if next_offset >= end_offset {
2311 return Ok(());
2312 }
2313
2314 while _next_ordinal_to_read < 1 {
2316 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2317 _next_ordinal_to_read += 1;
2318 next_offset += envelope_size;
2319 }
2320
2321 let next_out_of_line = decoder.next_out_of_line();
2322 let handles_before = decoder.remaining_handles();
2323 if let Some((inlined, num_bytes, num_handles)) =
2324 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2325 {
2326 let member_inline_size = <fidl::encoding::Vector<NoiseFloorHistogram, 8> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2327 if inlined != (member_inline_size <= 4) {
2328 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2329 }
2330 let inner_offset;
2331 let mut inner_depth = depth.clone();
2332 if inlined {
2333 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2334 inner_offset = next_offset;
2335 } else {
2336 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2337 inner_depth.increment()?;
2338 }
2339 let val_ref = self.noise_floor_histograms.get_or_insert_with(
2340 || fidl::new_empty!(fidl::encoding::Vector<NoiseFloorHistogram, 8>, D),
2341 );
2342 fidl::decode!(fidl::encoding::Vector<NoiseFloorHistogram, 8>, D, val_ref, decoder, inner_offset, inner_depth)?;
2343 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2344 {
2345 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2346 }
2347 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2348 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2349 }
2350 }
2351
2352 next_offset += envelope_size;
2353 _next_ordinal_to_read += 1;
2354 if next_offset >= end_offset {
2355 return Ok(());
2356 }
2357
2358 while _next_ordinal_to_read < 2 {
2360 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2361 _next_ordinal_to_read += 1;
2362 next_offset += envelope_size;
2363 }
2364
2365 let next_out_of_line = decoder.next_out_of_line();
2366 let handles_before = decoder.remaining_handles();
2367 if let Some((inlined, num_bytes, num_handles)) =
2368 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2369 {
2370 let member_inline_size = <fidl::encoding::Vector<RssiHistogram, 8> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2371 if inlined != (member_inline_size <= 4) {
2372 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2373 }
2374 let inner_offset;
2375 let mut inner_depth = depth.clone();
2376 if inlined {
2377 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2378 inner_offset = next_offset;
2379 } else {
2380 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2381 inner_depth.increment()?;
2382 }
2383 let val_ref = self.rssi_histograms.get_or_insert_with(
2384 || fidl::new_empty!(fidl::encoding::Vector<RssiHistogram, 8>, D),
2385 );
2386 fidl::decode!(fidl::encoding::Vector<RssiHistogram, 8>, D, val_ref, decoder, inner_offset, inner_depth)?;
2387 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2388 {
2389 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2390 }
2391 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2392 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2393 }
2394 }
2395
2396 next_offset += envelope_size;
2397 _next_ordinal_to_read += 1;
2398 if next_offset >= end_offset {
2399 return Ok(());
2400 }
2401
2402 while _next_ordinal_to_read < 3 {
2404 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2405 _next_ordinal_to_read += 1;
2406 next_offset += envelope_size;
2407 }
2408
2409 let next_out_of_line = decoder.next_out_of_line();
2410 let handles_before = decoder.remaining_handles();
2411 if let Some((inlined, num_bytes, num_handles)) =
2412 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2413 {
2414 let member_inline_size = <fidl::encoding::Vector<RxRateIndexHistogram, 8> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2415 if inlined != (member_inline_size <= 4) {
2416 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2417 }
2418 let inner_offset;
2419 let mut inner_depth = depth.clone();
2420 if inlined {
2421 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2422 inner_offset = next_offset;
2423 } else {
2424 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2425 inner_depth.increment()?;
2426 }
2427 let val_ref = self.rx_rate_index_histograms.get_or_insert_with(
2428 || fidl::new_empty!(fidl::encoding::Vector<RxRateIndexHistogram, 8>, D),
2429 );
2430 fidl::decode!(fidl::encoding::Vector<RxRateIndexHistogram, 8>, D, val_ref, decoder, inner_offset, inner_depth)?;
2431 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2432 {
2433 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2434 }
2435 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2436 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2437 }
2438 }
2439
2440 next_offset += envelope_size;
2441 _next_ordinal_to_read += 1;
2442 if next_offset >= end_offset {
2443 return Ok(());
2444 }
2445
2446 while _next_ordinal_to_read < 4 {
2448 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2449 _next_ordinal_to_read += 1;
2450 next_offset += envelope_size;
2451 }
2452
2453 let next_out_of_line = decoder.next_out_of_line();
2454 let handles_before = decoder.remaining_handles();
2455 if let Some((inlined, num_bytes, num_handles)) =
2456 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2457 {
2458 let member_inline_size = <fidl::encoding::Vector<SnrHistogram, 8> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2459 if inlined != (member_inline_size <= 4) {
2460 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2461 }
2462 let inner_offset;
2463 let mut inner_depth = depth.clone();
2464 if inlined {
2465 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2466 inner_offset = next_offset;
2467 } else {
2468 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2469 inner_depth.increment()?;
2470 }
2471 let val_ref = self.snr_histograms.get_or_insert_with(
2472 || fidl::new_empty!(fidl::encoding::Vector<SnrHistogram, 8>, D),
2473 );
2474 fidl::decode!(fidl::encoding::Vector<SnrHistogram, 8>, D, val_ref, decoder, inner_offset, inner_depth)?;
2475 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2476 {
2477 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2478 }
2479 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2480 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2481 }
2482 }
2483
2484 next_offset += envelope_size;
2485
2486 while next_offset < end_offset {
2488 _next_ordinal_to_read += 1;
2489 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2490 next_offset += envelope_size;
2491 }
2492
2493 Ok(())
2494 }
2495 }
2496
2497 impl IfaceStats {
2498 #[inline(always)]
2499 fn max_ordinal_present(&self) -> u64 {
2500 if let Some(_) = self.driver_specific_gauges {
2501 return 3;
2502 }
2503 if let Some(_) = self.driver_specific_counters {
2504 return 2;
2505 }
2506 if let Some(_) = self.connection_stats {
2507 return 1;
2508 }
2509 0
2510 }
2511 }
2512
2513 impl fidl::encoding::ValueTypeMarker for IfaceStats {
2514 type Borrowed<'a> = &'a Self;
2515 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2516 value
2517 }
2518 }
2519
2520 unsafe impl fidl::encoding::TypeMarker for IfaceStats {
2521 type Owned = Self;
2522
2523 #[inline(always)]
2524 fn inline_align(_context: fidl::encoding::Context) -> usize {
2525 8
2526 }
2527
2528 #[inline(always)]
2529 fn inline_size(_context: fidl::encoding::Context) -> usize {
2530 16
2531 }
2532 }
2533
2534 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<IfaceStats, D>
2535 for &IfaceStats
2536 {
2537 unsafe fn encode(
2538 self,
2539 encoder: &mut fidl::encoding::Encoder<'_, D>,
2540 offset: usize,
2541 mut depth: fidl::encoding::Depth,
2542 ) -> fidl::Result<()> {
2543 encoder.debug_check_bounds::<IfaceStats>(offset);
2544 let max_ordinal: u64 = self.max_ordinal_present();
2546 encoder.write_num(max_ordinal, offset);
2547 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2548 if max_ordinal == 0 {
2550 return Ok(());
2551 }
2552 depth.increment()?;
2553 let envelope_size = 8;
2554 let bytes_len = max_ordinal as usize * envelope_size;
2555 #[allow(unused_variables)]
2556 let offset = encoder.out_of_line_offset(bytes_len);
2557 let mut _prev_end_offset: usize = 0;
2558 if 1 > max_ordinal {
2559 return Ok(());
2560 }
2561
2562 let cur_offset: usize = (1 - 1) * envelope_size;
2565
2566 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2568
2569 fidl::encoding::encode_in_envelope_optional::<ConnectionStats, D>(
2574 self.connection_stats
2575 .as_ref()
2576 .map(<ConnectionStats as fidl::encoding::ValueTypeMarker>::borrow),
2577 encoder,
2578 offset + cur_offset,
2579 depth,
2580 )?;
2581
2582 _prev_end_offset = cur_offset + envelope_size;
2583 if 2 > max_ordinal {
2584 return Ok(());
2585 }
2586
2587 let cur_offset: usize = (2 - 1) * envelope_size;
2590
2591 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2593
2594 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<UnnamedCounter, 127>, D>(
2599 self.driver_specific_counters.as_ref().map(<fidl::encoding::Vector<UnnamedCounter, 127> as fidl::encoding::ValueTypeMarker>::borrow),
2600 encoder, offset + cur_offset, depth
2601 )?;
2602
2603 _prev_end_offset = cur_offset + envelope_size;
2604 if 3 > max_ordinal {
2605 return Ok(());
2606 }
2607
2608 let cur_offset: usize = (3 - 1) * envelope_size;
2611
2612 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2614
2615 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<UnnamedGauge, 127>, D>(
2620 self.driver_specific_gauges.as_ref().map(<fidl::encoding::Vector<UnnamedGauge, 127> as fidl::encoding::ValueTypeMarker>::borrow),
2621 encoder, offset + cur_offset, depth
2622 )?;
2623
2624 _prev_end_offset = cur_offset + envelope_size;
2625
2626 Ok(())
2627 }
2628 }
2629
2630 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for IfaceStats {
2631 #[inline(always)]
2632 fn new_empty() -> Self {
2633 Self::default()
2634 }
2635
2636 unsafe fn decode(
2637 &mut self,
2638 decoder: &mut fidl::encoding::Decoder<'_, D>,
2639 offset: usize,
2640 mut depth: fidl::encoding::Depth,
2641 ) -> fidl::Result<()> {
2642 decoder.debug_check_bounds::<Self>(offset);
2643 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2644 None => return Err(fidl::Error::NotNullable),
2645 Some(len) => len,
2646 };
2647 if len == 0 {
2649 return Ok(());
2650 };
2651 depth.increment()?;
2652 let envelope_size = 8;
2653 let bytes_len = len * envelope_size;
2654 let offset = decoder.out_of_line_offset(bytes_len)?;
2655 let mut _next_ordinal_to_read = 0;
2657 let mut next_offset = offset;
2658 let end_offset = offset + bytes_len;
2659 _next_ordinal_to_read += 1;
2660 if next_offset >= end_offset {
2661 return Ok(());
2662 }
2663
2664 while _next_ordinal_to_read < 1 {
2666 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2667 _next_ordinal_to_read += 1;
2668 next_offset += envelope_size;
2669 }
2670
2671 let next_out_of_line = decoder.next_out_of_line();
2672 let handles_before = decoder.remaining_handles();
2673 if let Some((inlined, num_bytes, num_handles)) =
2674 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2675 {
2676 let member_inline_size =
2677 <ConnectionStats as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2678 if inlined != (member_inline_size <= 4) {
2679 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2680 }
2681 let inner_offset;
2682 let mut inner_depth = depth.clone();
2683 if inlined {
2684 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2685 inner_offset = next_offset;
2686 } else {
2687 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2688 inner_depth.increment()?;
2689 }
2690 let val_ref = self
2691 .connection_stats
2692 .get_or_insert_with(|| fidl::new_empty!(ConnectionStats, D));
2693 fidl::decode!(ConnectionStats, D, val_ref, decoder, inner_offset, inner_depth)?;
2694 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2695 {
2696 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2697 }
2698 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2699 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2700 }
2701 }
2702
2703 next_offset += envelope_size;
2704 _next_ordinal_to_read += 1;
2705 if next_offset >= end_offset {
2706 return Ok(());
2707 }
2708
2709 while _next_ordinal_to_read < 2 {
2711 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2712 _next_ordinal_to_read += 1;
2713 next_offset += envelope_size;
2714 }
2715
2716 let next_out_of_line = decoder.next_out_of_line();
2717 let handles_before = decoder.remaining_handles();
2718 if let Some((inlined, num_bytes, num_handles)) =
2719 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2720 {
2721 let member_inline_size = <fidl::encoding::Vector<UnnamedCounter, 127> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2722 if inlined != (member_inline_size <= 4) {
2723 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2724 }
2725 let inner_offset;
2726 let mut inner_depth = depth.clone();
2727 if inlined {
2728 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2729 inner_offset = next_offset;
2730 } else {
2731 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2732 inner_depth.increment()?;
2733 }
2734 let val_ref = self.driver_specific_counters.get_or_insert_with(
2735 || fidl::new_empty!(fidl::encoding::Vector<UnnamedCounter, 127>, D),
2736 );
2737 fidl::decode!(fidl::encoding::Vector<UnnamedCounter, 127>, D, val_ref, decoder, inner_offset, inner_depth)?;
2738 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2739 {
2740 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2741 }
2742 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2743 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2744 }
2745 }
2746
2747 next_offset += envelope_size;
2748 _next_ordinal_to_read += 1;
2749 if next_offset >= end_offset {
2750 return Ok(());
2751 }
2752
2753 while _next_ordinal_to_read < 3 {
2755 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2756 _next_ordinal_to_read += 1;
2757 next_offset += envelope_size;
2758 }
2759
2760 let next_out_of_line = decoder.next_out_of_line();
2761 let handles_before = decoder.remaining_handles();
2762 if let Some((inlined, num_bytes, num_handles)) =
2763 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2764 {
2765 let member_inline_size = <fidl::encoding::Vector<UnnamedGauge, 127> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2766 if inlined != (member_inline_size <= 4) {
2767 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2768 }
2769 let inner_offset;
2770 let mut inner_depth = depth.clone();
2771 if inlined {
2772 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2773 inner_offset = next_offset;
2774 } else {
2775 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2776 inner_depth.increment()?;
2777 }
2778 let val_ref = self.driver_specific_gauges.get_or_insert_with(
2779 || fidl::new_empty!(fidl::encoding::Vector<UnnamedGauge, 127>, D),
2780 );
2781 fidl::decode!(fidl::encoding::Vector<UnnamedGauge, 127>, D, val_ref, decoder, inner_offset, inner_depth)?;
2782 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2783 {
2784 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2785 }
2786 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2787 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2788 }
2789 }
2790
2791 next_offset += envelope_size;
2792
2793 while next_offset < end_offset {
2795 _next_ordinal_to_read += 1;
2796 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2797 next_offset += envelope_size;
2798 }
2799
2800 Ok(())
2801 }
2802 }
2803
2804 impl InspectCounterConfig {
2805 #[inline(always)]
2806 fn max_ordinal_present(&self) -> u64 {
2807 if let Some(_) = self.counter_name {
2808 return 2;
2809 }
2810 if let Some(_) = self.counter_id {
2811 return 1;
2812 }
2813 0
2814 }
2815 }
2816
2817 impl fidl::encoding::ValueTypeMarker for InspectCounterConfig {
2818 type Borrowed<'a> = &'a Self;
2819 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2820 value
2821 }
2822 }
2823
2824 unsafe impl fidl::encoding::TypeMarker for InspectCounterConfig {
2825 type Owned = Self;
2826
2827 #[inline(always)]
2828 fn inline_align(_context: fidl::encoding::Context) -> usize {
2829 8
2830 }
2831
2832 #[inline(always)]
2833 fn inline_size(_context: fidl::encoding::Context) -> usize {
2834 16
2835 }
2836 }
2837
2838 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InspectCounterConfig, D>
2839 for &InspectCounterConfig
2840 {
2841 unsafe fn encode(
2842 self,
2843 encoder: &mut fidl::encoding::Encoder<'_, D>,
2844 offset: usize,
2845 mut depth: fidl::encoding::Depth,
2846 ) -> fidl::Result<()> {
2847 encoder.debug_check_bounds::<InspectCounterConfig>(offset);
2848 let max_ordinal: u64 = self.max_ordinal_present();
2850 encoder.write_num(max_ordinal, offset);
2851 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2852 if max_ordinal == 0 {
2854 return Ok(());
2855 }
2856 depth.increment()?;
2857 let envelope_size = 8;
2858 let bytes_len = max_ordinal as usize * envelope_size;
2859 #[allow(unused_variables)]
2860 let offset = encoder.out_of_line_offset(bytes_len);
2861 let mut _prev_end_offset: usize = 0;
2862 if 1 > max_ordinal {
2863 return Ok(());
2864 }
2865
2866 let cur_offset: usize = (1 - 1) * envelope_size;
2869
2870 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2872
2873 fidl::encoding::encode_in_envelope_optional::<u16, D>(
2878 self.counter_id.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
2879 encoder,
2880 offset + cur_offset,
2881 depth,
2882 )?;
2883
2884 _prev_end_offset = cur_offset + envelope_size;
2885 if 2 > max_ordinal {
2886 return Ok(());
2887 }
2888
2889 let cur_offset: usize = (2 - 1) * envelope_size;
2892
2893 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2895
2896 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<127>, D>(
2901 self.counter_name.as_ref().map(
2902 <fidl::encoding::BoundedString<127> as fidl::encoding::ValueTypeMarker>::borrow,
2903 ),
2904 encoder,
2905 offset + cur_offset,
2906 depth,
2907 )?;
2908
2909 _prev_end_offset = cur_offset + envelope_size;
2910
2911 Ok(())
2912 }
2913 }
2914
2915 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InspectCounterConfig {
2916 #[inline(always)]
2917 fn new_empty() -> Self {
2918 Self::default()
2919 }
2920
2921 unsafe fn decode(
2922 &mut self,
2923 decoder: &mut fidl::encoding::Decoder<'_, D>,
2924 offset: usize,
2925 mut depth: fidl::encoding::Depth,
2926 ) -> fidl::Result<()> {
2927 decoder.debug_check_bounds::<Self>(offset);
2928 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2929 None => return Err(fidl::Error::NotNullable),
2930 Some(len) => len,
2931 };
2932 if len == 0 {
2934 return Ok(());
2935 };
2936 depth.increment()?;
2937 let envelope_size = 8;
2938 let bytes_len = len * envelope_size;
2939 let offset = decoder.out_of_line_offset(bytes_len)?;
2940 let mut _next_ordinal_to_read = 0;
2942 let mut next_offset = offset;
2943 let end_offset = offset + bytes_len;
2944 _next_ordinal_to_read += 1;
2945 if next_offset >= end_offset {
2946 return Ok(());
2947 }
2948
2949 while _next_ordinal_to_read < 1 {
2951 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2952 _next_ordinal_to_read += 1;
2953 next_offset += envelope_size;
2954 }
2955
2956 let next_out_of_line = decoder.next_out_of_line();
2957 let handles_before = decoder.remaining_handles();
2958 if let Some((inlined, num_bytes, num_handles)) =
2959 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2960 {
2961 let member_inline_size =
2962 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2963 if inlined != (member_inline_size <= 4) {
2964 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2965 }
2966 let inner_offset;
2967 let mut inner_depth = depth.clone();
2968 if inlined {
2969 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2970 inner_offset = next_offset;
2971 } else {
2972 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2973 inner_depth.increment()?;
2974 }
2975 let val_ref = self.counter_id.get_or_insert_with(|| fidl::new_empty!(u16, D));
2976 fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
2977 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2978 {
2979 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2980 }
2981 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2982 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2983 }
2984 }
2985
2986 next_offset += envelope_size;
2987 _next_ordinal_to_read += 1;
2988 if next_offset >= end_offset {
2989 return Ok(());
2990 }
2991
2992 while _next_ordinal_to_read < 2 {
2994 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2995 _next_ordinal_to_read += 1;
2996 next_offset += envelope_size;
2997 }
2998
2999 let next_out_of_line = decoder.next_out_of_line();
3000 let handles_before = decoder.remaining_handles();
3001 if let Some((inlined, num_bytes, num_handles)) =
3002 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3003 {
3004 let member_inline_size =
3005 <fidl::encoding::BoundedString<127> as fidl::encoding::TypeMarker>::inline_size(
3006 decoder.context,
3007 );
3008 if inlined != (member_inline_size <= 4) {
3009 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3010 }
3011 let inner_offset;
3012 let mut inner_depth = depth.clone();
3013 if inlined {
3014 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3015 inner_offset = next_offset;
3016 } else {
3017 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3018 inner_depth.increment()?;
3019 }
3020 let val_ref = self
3021 .counter_name
3022 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<127>, D));
3023 fidl::decode!(
3024 fidl::encoding::BoundedString<127>,
3025 D,
3026 val_ref,
3027 decoder,
3028 inner_offset,
3029 inner_depth
3030 )?;
3031 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3032 {
3033 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3034 }
3035 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3036 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3037 }
3038 }
3039
3040 next_offset += envelope_size;
3041
3042 while next_offset < end_offset {
3044 _next_ordinal_to_read += 1;
3045 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3046 next_offset += envelope_size;
3047 }
3048
3049 Ok(())
3050 }
3051 }
3052
3053 impl InspectGaugeConfig {
3054 #[inline(always)]
3055 fn max_ordinal_present(&self) -> u64 {
3056 if let Some(_) = self.statistics {
3057 return 3;
3058 }
3059 if let Some(_) = self.gauge_name {
3060 return 2;
3061 }
3062 if let Some(_) = self.gauge_id {
3063 return 1;
3064 }
3065 0
3066 }
3067 }
3068
3069 impl fidl::encoding::ValueTypeMarker for InspectGaugeConfig {
3070 type Borrowed<'a> = &'a Self;
3071 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3072 value
3073 }
3074 }
3075
3076 unsafe impl fidl::encoding::TypeMarker for InspectGaugeConfig {
3077 type Owned = Self;
3078
3079 #[inline(always)]
3080 fn inline_align(_context: fidl::encoding::Context) -> usize {
3081 8
3082 }
3083
3084 #[inline(always)]
3085 fn inline_size(_context: fidl::encoding::Context) -> usize {
3086 16
3087 }
3088 }
3089
3090 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InspectGaugeConfig, D>
3091 for &InspectGaugeConfig
3092 {
3093 unsafe fn encode(
3094 self,
3095 encoder: &mut fidl::encoding::Encoder<'_, D>,
3096 offset: usize,
3097 mut depth: fidl::encoding::Depth,
3098 ) -> fidl::Result<()> {
3099 encoder.debug_check_bounds::<InspectGaugeConfig>(offset);
3100 let max_ordinal: u64 = self.max_ordinal_present();
3102 encoder.write_num(max_ordinal, offset);
3103 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3104 if max_ordinal == 0 {
3106 return Ok(());
3107 }
3108 depth.increment()?;
3109 let envelope_size = 8;
3110 let bytes_len = max_ordinal as usize * envelope_size;
3111 #[allow(unused_variables)]
3112 let offset = encoder.out_of_line_offset(bytes_len);
3113 let mut _prev_end_offset: usize = 0;
3114 if 1 > max_ordinal {
3115 return Ok(());
3116 }
3117
3118 let cur_offset: usize = (1 - 1) * envelope_size;
3121
3122 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3124
3125 fidl::encoding::encode_in_envelope_optional::<u16, D>(
3130 self.gauge_id.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
3131 encoder,
3132 offset + cur_offset,
3133 depth,
3134 )?;
3135
3136 _prev_end_offset = cur_offset + envelope_size;
3137 if 2 > max_ordinal {
3138 return Ok(());
3139 }
3140
3141 let cur_offset: usize = (2 - 1) * envelope_size;
3144
3145 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3147
3148 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<127>, D>(
3153 self.gauge_name.as_ref().map(
3154 <fidl::encoding::BoundedString<127> as fidl::encoding::ValueTypeMarker>::borrow,
3155 ),
3156 encoder,
3157 offset + cur_offset,
3158 depth,
3159 )?;
3160
3161 _prev_end_offset = cur_offset + envelope_size;
3162 if 3 > max_ordinal {
3163 return Ok(());
3164 }
3165
3166 let cur_offset: usize = (3 - 1) * envelope_size;
3169
3170 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3172
3173 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<GaugeStatistic, 5>, D>(
3178 self.statistics.as_ref().map(<fidl::encoding::Vector<GaugeStatistic, 5> as fidl::encoding::ValueTypeMarker>::borrow),
3179 encoder, offset + cur_offset, depth
3180 )?;
3181
3182 _prev_end_offset = cur_offset + envelope_size;
3183
3184 Ok(())
3185 }
3186 }
3187
3188 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InspectGaugeConfig {
3189 #[inline(always)]
3190 fn new_empty() -> Self {
3191 Self::default()
3192 }
3193
3194 unsafe fn decode(
3195 &mut self,
3196 decoder: &mut fidl::encoding::Decoder<'_, D>,
3197 offset: usize,
3198 mut depth: fidl::encoding::Depth,
3199 ) -> fidl::Result<()> {
3200 decoder.debug_check_bounds::<Self>(offset);
3201 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3202 None => return Err(fidl::Error::NotNullable),
3203 Some(len) => len,
3204 };
3205 if len == 0 {
3207 return Ok(());
3208 };
3209 depth.increment()?;
3210 let envelope_size = 8;
3211 let bytes_len = len * envelope_size;
3212 let offset = decoder.out_of_line_offset(bytes_len)?;
3213 let mut _next_ordinal_to_read = 0;
3215 let mut next_offset = offset;
3216 let end_offset = offset + bytes_len;
3217 _next_ordinal_to_read += 1;
3218 if next_offset >= end_offset {
3219 return Ok(());
3220 }
3221
3222 while _next_ordinal_to_read < 1 {
3224 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3225 _next_ordinal_to_read += 1;
3226 next_offset += envelope_size;
3227 }
3228
3229 let next_out_of_line = decoder.next_out_of_line();
3230 let handles_before = decoder.remaining_handles();
3231 if let Some((inlined, num_bytes, num_handles)) =
3232 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3233 {
3234 let member_inline_size =
3235 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3236 if inlined != (member_inline_size <= 4) {
3237 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3238 }
3239 let inner_offset;
3240 let mut inner_depth = depth.clone();
3241 if inlined {
3242 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3243 inner_offset = next_offset;
3244 } else {
3245 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3246 inner_depth.increment()?;
3247 }
3248 let val_ref = self.gauge_id.get_or_insert_with(|| fidl::new_empty!(u16, D));
3249 fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
3250 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3251 {
3252 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3253 }
3254 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3255 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3256 }
3257 }
3258
3259 next_offset += envelope_size;
3260 _next_ordinal_to_read += 1;
3261 if next_offset >= end_offset {
3262 return Ok(());
3263 }
3264
3265 while _next_ordinal_to_read < 2 {
3267 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3268 _next_ordinal_to_read += 1;
3269 next_offset += envelope_size;
3270 }
3271
3272 let next_out_of_line = decoder.next_out_of_line();
3273 let handles_before = decoder.remaining_handles();
3274 if let Some((inlined, num_bytes, num_handles)) =
3275 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3276 {
3277 let member_inline_size =
3278 <fidl::encoding::BoundedString<127> as fidl::encoding::TypeMarker>::inline_size(
3279 decoder.context,
3280 );
3281 if inlined != (member_inline_size <= 4) {
3282 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3283 }
3284 let inner_offset;
3285 let mut inner_depth = depth.clone();
3286 if inlined {
3287 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3288 inner_offset = next_offset;
3289 } else {
3290 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3291 inner_depth.increment()?;
3292 }
3293 let val_ref = self
3294 .gauge_name
3295 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<127>, D));
3296 fidl::decode!(
3297 fidl::encoding::BoundedString<127>,
3298 D,
3299 val_ref,
3300 decoder,
3301 inner_offset,
3302 inner_depth
3303 )?;
3304 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3305 {
3306 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3307 }
3308 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3309 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3310 }
3311 }
3312
3313 next_offset += envelope_size;
3314 _next_ordinal_to_read += 1;
3315 if next_offset >= end_offset {
3316 return Ok(());
3317 }
3318
3319 while _next_ordinal_to_read < 3 {
3321 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3322 _next_ordinal_to_read += 1;
3323 next_offset += envelope_size;
3324 }
3325
3326 let next_out_of_line = decoder.next_out_of_line();
3327 let handles_before = decoder.remaining_handles();
3328 if let Some((inlined, num_bytes, num_handles)) =
3329 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3330 {
3331 let member_inline_size = <fidl::encoding::Vector<GaugeStatistic, 5> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3332 if inlined != (member_inline_size <= 4) {
3333 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3334 }
3335 let inner_offset;
3336 let mut inner_depth = depth.clone();
3337 if inlined {
3338 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3339 inner_offset = next_offset;
3340 } else {
3341 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3342 inner_depth.increment()?;
3343 }
3344 let val_ref = self.statistics.get_or_insert_with(
3345 || fidl::new_empty!(fidl::encoding::Vector<GaugeStatistic, 5>, D),
3346 );
3347 fidl::decode!(fidl::encoding::Vector<GaugeStatistic, 5>, D, val_ref, decoder, inner_offset, inner_depth)?;
3348 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3349 {
3350 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3351 }
3352 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3353 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3354 }
3355 }
3356
3357 next_offset += envelope_size;
3358
3359 while next_offset < end_offset {
3361 _next_ordinal_to_read += 1;
3362 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3363 next_offset += envelope_size;
3364 }
3365
3366 Ok(())
3367 }
3368 }
3369
3370 impl TelemetrySupport {
3371 #[inline(always)]
3372 fn max_ordinal_present(&self) -> u64 {
3373 if let Some(_) = self.inspect_gauge_configs {
3374 return 2;
3375 }
3376 if let Some(_) = self.inspect_counter_configs {
3377 return 1;
3378 }
3379 0
3380 }
3381 }
3382
3383 impl fidl::encoding::ValueTypeMarker for TelemetrySupport {
3384 type Borrowed<'a> = &'a Self;
3385 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3386 value
3387 }
3388 }
3389
3390 unsafe impl fidl::encoding::TypeMarker for TelemetrySupport {
3391 type Owned = Self;
3392
3393 #[inline(always)]
3394 fn inline_align(_context: fidl::encoding::Context) -> usize {
3395 8
3396 }
3397
3398 #[inline(always)]
3399 fn inline_size(_context: fidl::encoding::Context) -> usize {
3400 16
3401 }
3402 }
3403
3404 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TelemetrySupport, D>
3405 for &TelemetrySupport
3406 {
3407 unsafe fn encode(
3408 self,
3409 encoder: &mut fidl::encoding::Encoder<'_, D>,
3410 offset: usize,
3411 mut depth: fidl::encoding::Depth,
3412 ) -> fidl::Result<()> {
3413 encoder.debug_check_bounds::<TelemetrySupport>(offset);
3414 let max_ordinal: u64 = self.max_ordinal_present();
3416 encoder.write_num(max_ordinal, offset);
3417 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3418 if max_ordinal == 0 {
3420 return Ok(());
3421 }
3422 depth.increment()?;
3423 let envelope_size = 8;
3424 let bytes_len = max_ordinal as usize * envelope_size;
3425 #[allow(unused_variables)]
3426 let offset = encoder.out_of_line_offset(bytes_len);
3427 let mut _prev_end_offset: usize = 0;
3428 if 1 > max_ordinal {
3429 return Ok(());
3430 }
3431
3432 let cur_offset: usize = (1 - 1) * envelope_size;
3435
3436 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3438
3439 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<InspectCounterConfig, 127>, D>(
3444 self.inspect_counter_configs.as_ref().map(<fidl::encoding::Vector<InspectCounterConfig, 127> as fidl::encoding::ValueTypeMarker>::borrow),
3445 encoder, offset + cur_offset, depth
3446 )?;
3447
3448 _prev_end_offset = cur_offset + envelope_size;
3449 if 2 > max_ordinal {
3450 return Ok(());
3451 }
3452
3453 let cur_offset: usize = (2 - 1) * envelope_size;
3456
3457 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3459
3460 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<InspectGaugeConfig, 127>, D>(
3465 self.inspect_gauge_configs.as_ref().map(<fidl::encoding::Vector<InspectGaugeConfig, 127> as fidl::encoding::ValueTypeMarker>::borrow),
3466 encoder, offset + cur_offset, depth
3467 )?;
3468
3469 _prev_end_offset = cur_offset + envelope_size;
3470
3471 Ok(())
3472 }
3473 }
3474
3475 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TelemetrySupport {
3476 #[inline(always)]
3477 fn new_empty() -> Self {
3478 Self::default()
3479 }
3480
3481 unsafe fn decode(
3482 &mut self,
3483 decoder: &mut fidl::encoding::Decoder<'_, D>,
3484 offset: usize,
3485 mut depth: fidl::encoding::Depth,
3486 ) -> fidl::Result<()> {
3487 decoder.debug_check_bounds::<Self>(offset);
3488 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3489 None => return Err(fidl::Error::NotNullable),
3490 Some(len) => len,
3491 };
3492 if len == 0 {
3494 return Ok(());
3495 };
3496 depth.increment()?;
3497 let envelope_size = 8;
3498 let bytes_len = len * envelope_size;
3499 let offset = decoder.out_of_line_offset(bytes_len)?;
3500 let mut _next_ordinal_to_read = 0;
3502 let mut next_offset = offset;
3503 let end_offset = offset + bytes_len;
3504 _next_ordinal_to_read += 1;
3505 if next_offset >= end_offset {
3506 return Ok(());
3507 }
3508
3509 while _next_ordinal_to_read < 1 {
3511 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3512 _next_ordinal_to_read += 1;
3513 next_offset += envelope_size;
3514 }
3515
3516 let next_out_of_line = decoder.next_out_of_line();
3517 let handles_before = decoder.remaining_handles();
3518 if let Some((inlined, num_bytes, num_handles)) =
3519 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3520 {
3521 let member_inline_size = <fidl::encoding::Vector<InspectCounterConfig, 127> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3522 if inlined != (member_inline_size <= 4) {
3523 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3524 }
3525 let inner_offset;
3526 let mut inner_depth = depth.clone();
3527 if inlined {
3528 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3529 inner_offset = next_offset;
3530 } else {
3531 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3532 inner_depth.increment()?;
3533 }
3534 let val_ref = self.inspect_counter_configs.get_or_insert_with(
3535 || fidl::new_empty!(fidl::encoding::Vector<InspectCounterConfig, 127>, D),
3536 );
3537 fidl::decode!(fidl::encoding::Vector<InspectCounterConfig, 127>, D, val_ref, decoder, inner_offset, inner_depth)?;
3538 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3539 {
3540 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3541 }
3542 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3543 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3544 }
3545 }
3546
3547 next_offset += envelope_size;
3548 _next_ordinal_to_read += 1;
3549 if next_offset >= end_offset {
3550 return Ok(());
3551 }
3552
3553 while _next_ordinal_to_read < 2 {
3555 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3556 _next_ordinal_to_read += 1;
3557 next_offset += envelope_size;
3558 }
3559
3560 let next_out_of_line = decoder.next_out_of_line();
3561 let handles_before = decoder.remaining_handles();
3562 if let Some((inlined, num_bytes, num_handles)) =
3563 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3564 {
3565 let member_inline_size = <fidl::encoding::Vector<InspectGaugeConfig, 127> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3566 if inlined != (member_inline_size <= 4) {
3567 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3568 }
3569 let inner_offset;
3570 let mut inner_depth = depth.clone();
3571 if inlined {
3572 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3573 inner_offset = next_offset;
3574 } else {
3575 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3576 inner_depth.increment()?;
3577 }
3578 let val_ref = self.inspect_gauge_configs.get_or_insert_with(
3579 || fidl::new_empty!(fidl::encoding::Vector<InspectGaugeConfig, 127>, D),
3580 );
3581 fidl::decode!(fidl::encoding::Vector<InspectGaugeConfig, 127>, D, val_ref, decoder, inner_offset, inner_depth)?;
3582 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3583 {
3584 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3585 }
3586 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3587 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3588 }
3589 }
3590
3591 next_offset += envelope_size;
3592
3593 while next_offset < end_offset {
3595 _next_ordinal_to_read += 1;
3596 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3597 next_offset += envelope_size;
3598 }
3599
3600 Ok(())
3601 }
3602 }
3603}