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 type ClientId = String;
12
13#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
17#[repr(u32)]
18pub enum RecorderError {
19 NoDrivers = 1,
21 InvalidSamplingInterval = 2,
23 AlreadyLogging = 3,
26 DuplicatedMetric = 4,
28 TooManyActiveClients = 5,
32 InvalidStatisticsInterval = 6,
35 Internal = 7,
37}
38
39impl RecorderError {
40 #[inline]
41 pub fn from_primitive(prim: u32) -> Option<Self> {
42 match prim {
43 1 => Some(Self::NoDrivers),
44 2 => Some(Self::InvalidSamplingInterval),
45 3 => Some(Self::AlreadyLogging),
46 4 => Some(Self::DuplicatedMetric),
47 5 => Some(Self::TooManyActiveClients),
48 6 => Some(Self::InvalidStatisticsInterval),
49 7 => Some(Self::Internal),
50 _ => None,
51 }
52 }
53
54 #[inline]
55 pub const fn into_primitive(self) -> u32 {
56 self as u32
57 }
58}
59
60#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
62#[repr(C)]
63pub struct CpuLoad {
64 pub interval_ms: u32,
69}
70
71impl fidl::Persistable for CpuLoad {}
72
73#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
75#[repr(C)]
76pub struct GpuUsage {
77 pub interval_ms: u32,
82}
83
84impl fidl::Persistable for GpuUsage {}
85
86#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
88#[repr(C)]
89pub struct NetworkActivity {
90 pub interval_ms: u32,
95}
96
97impl fidl::Persistable for NetworkActivity {}
98
99#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
101pub struct Power {
102 pub sampling_interval_ms: u32,
107 pub statistics_args: Option<Box<StatisticsArgs>>,
109}
110
111impl fidl::Persistable for Power {}
112
113#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
114pub struct RecorderStartLoggingForeverRequest {
115 pub client_id: String,
116 pub metrics: Vec<Metric>,
117 pub output_samples_to_syslog: bool,
118 pub output_stats_to_syslog: bool,
119}
120
121impl fidl::Persistable for RecorderStartLoggingForeverRequest {}
122
123#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
124pub struct RecorderStartLoggingRequest {
125 pub client_id: String,
126 pub metrics: Vec<Metric>,
127 pub duration_ms: u32,
128 pub output_samples_to_syslog: bool,
129 pub output_stats_to_syslog: bool,
130}
131
132impl fidl::Persistable for RecorderStartLoggingRequest {}
133
134#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
135pub struct RecorderStopLoggingRequest {
136 pub client_id: String,
137}
138
139impl fidl::Persistable for RecorderStopLoggingRequest {}
140
141#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
142pub struct RecorderStopLoggingResponse {
143 pub stopped: bool,
144}
145
146impl fidl::Persistable for RecorderStopLoggingResponse {}
147
148#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
149#[repr(C)]
150pub struct StatisticsArgs {
151 pub statistics_interval_ms: u32,
158}
159
160impl fidl::Persistable for StatisticsArgs {}
161
162#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
164pub struct Temperature {
165 pub sampling_interval_ms: u32,
170 pub statistics_args: Option<Box<StatisticsArgs>>,
172}
173
174impl fidl::Persistable for Temperature {}
175
176#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
178pub enum Metric {
179 Temperature(Temperature),
180 CpuLoad(CpuLoad),
181 Power(Power),
182 GpuUsage(GpuUsage),
183 NetworkActivity(NetworkActivity),
184}
185
186impl Metric {
187 #[inline]
188 pub fn ordinal(&self) -> u64 {
189 match *self {
190 Self::Temperature(_) => 1,
191 Self::CpuLoad(_) => 2,
192 Self::Power(_) => 3,
193 Self::GpuUsage(_) => 4,
194 Self::NetworkActivity(_) => 5,
195 }
196 }
197}
198
199impl fidl::Persistable for Metric {}
200
201pub mod recorder_ordinals {
202 pub const START_LOGGING: u64 = 0x40e4e1a9c6c42bd2;
203 pub const START_LOGGING_FOREVER: u64 = 0x37b2675fdc61ff94;
204 pub const STOP_LOGGING: u64 = 0x615d67a4d94d4732;
205}
206
207mod internal {
208 use super::*;
209 unsafe impl fidl::encoding::TypeMarker for RecorderError {
210 type Owned = Self;
211
212 #[inline(always)]
213 fn inline_align(_context: fidl::encoding::Context) -> usize {
214 std::mem::align_of::<u32>()
215 }
216
217 #[inline(always)]
218 fn inline_size(_context: fidl::encoding::Context) -> usize {
219 std::mem::size_of::<u32>()
220 }
221
222 #[inline(always)]
223 fn encode_is_copy() -> bool {
224 true
225 }
226
227 #[inline(always)]
228 fn decode_is_copy() -> bool {
229 false
230 }
231 }
232
233 impl fidl::encoding::ValueTypeMarker for RecorderError {
234 type Borrowed<'a> = Self;
235 #[inline(always)]
236 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
237 *value
238 }
239 }
240
241 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for RecorderError {
242 #[inline]
243 unsafe fn encode(
244 self,
245 encoder: &mut fidl::encoding::Encoder<'_, D>,
246 offset: usize,
247 _depth: fidl::encoding::Depth,
248 ) -> fidl::Result<()> {
249 encoder.debug_check_bounds::<Self>(offset);
250 encoder.write_num(self.into_primitive(), offset);
251 Ok(())
252 }
253 }
254
255 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RecorderError {
256 #[inline(always)]
257 fn new_empty() -> Self {
258 Self::NoDrivers
259 }
260
261 #[inline]
262 unsafe fn decode(
263 &mut self,
264 decoder: &mut fidl::encoding::Decoder<'_, D>,
265 offset: usize,
266 _depth: fidl::encoding::Depth,
267 ) -> fidl::Result<()> {
268 decoder.debug_check_bounds::<Self>(offset);
269 let prim = decoder.read_num::<u32>(offset);
270
271 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
272 Ok(())
273 }
274 }
275
276 impl fidl::encoding::ValueTypeMarker for CpuLoad {
277 type Borrowed<'a> = &'a Self;
278 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
279 value
280 }
281 }
282
283 unsafe impl fidl::encoding::TypeMarker for CpuLoad {
284 type Owned = Self;
285
286 #[inline(always)]
287 fn inline_align(_context: fidl::encoding::Context) -> usize {
288 4
289 }
290
291 #[inline(always)]
292 fn inline_size(_context: fidl::encoding::Context) -> usize {
293 4
294 }
295 #[inline(always)]
296 fn encode_is_copy() -> bool {
297 true
298 }
299
300 #[inline(always)]
301 fn decode_is_copy() -> bool {
302 true
303 }
304 }
305
306 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CpuLoad, D> for &CpuLoad {
307 #[inline]
308 unsafe fn encode(
309 self,
310 encoder: &mut fidl::encoding::Encoder<'_, D>,
311 offset: usize,
312 _depth: fidl::encoding::Depth,
313 ) -> fidl::Result<()> {
314 encoder.debug_check_bounds::<CpuLoad>(offset);
315 unsafe {
316 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
318 (buf_ptr as *mut CpuLoad).write_unaligned((self as *const CpuLoad).read());
319 }
322 Ok(())
323 }
324 }
325 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
326 fidl::encoding::Encode<CpuLoad, D> for (T0,)
327 {
328 #[inline]
329 unsafe fn encode(
330 self,
331 encoder: &mut fidl::encoding::Encoder<'_, D>,
332 offset: usize,
333 depth: fidl::encoding::Depth,
334 ) -> fidl::Result<()> {
335 encoder.debug_check_bounds::<CpuLoad>(offset);
336 self.0.encode(encoder, offset + 0, depth)?;
340 Ok(())
341 }
342 }
343
344 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CpuLoad {
345 #[inline(always)]
346 fn new_empty() -> Self {
347 Self { interval_ms: fidl::new_empty!(u32, D) }
348 }
349
350 #[inline]
351 unsafe fn decode(
352 &mut self,
353 decoder: &mut fidl::encoding::Decoder<'_, D>,
354 offset: usize,
355 _depth: fidl::encoding::Depth,
356 ) -> fidl::Result<()> {
357 decoder.debug_check_bounds::<Self>(offset);
358 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
359 unsafe {
362 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
363 }
364 Ok(())
365 }
366 }
367
368 impl fidl::encoding::ValueTypeMarker for GpuUsage {
369 type Borrowed<'a> = &'a Self;
370 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
371 value
372 }
373 }
374
375 unsafe impl fidl::encoding::TypeMarker for GpuUsage {
376 type Owned = Self;
377
378 #[inline(always)]
379 fn inline_align(_context: fidl::encoding::Context) -> usize {
380 4
381 }
382
383 #[inline(always)]
384 fn inline_size(_context: fidl::encoding::Context) -> usize {
385 4
386 }
387 #[inline(always)]
388 fn encode_is_copy() -> bool {
389 true
390 }
391
392 #[inline(always)]
393 fn decode_is_copy() -> bool {
394 true
395 }
396 }
397
398 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<GpuUsage, D> for &GpuUsage {
399 #[inline]
400 unsafe fn encode(
401 self,
402 encoder: &mut fidl::encoding::Encoder<'_, D>,
403 offset: usize,
404 _depth: fidl::encoding::Depth,
405 ) -> fidl::Result<()> {
406 encoder.debug_check_bounds::<GpuUsage>(offset);
407 unsafe {
408 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
410 (buf_ptr as *mut GpuUsage).write_unaligned((self as *const GpuUsage).read());
411 }
414 Ok(())
415 }
416 }
417 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
418 fidl::encoding::Encode<GpuUsage, D> for (T0,)
419 {
420 #[inline]
421 unsafe fn encode(
422 self,
423 encoder: &mut fidl::encoding::Encoder<'_, D>,
424 offset: usize,
425 depth: fidl::encoding::Depth,
426 ) -> fidl::Result<()> {
427 encoder.debug_check_bounds::<GpuUsage>(offset);
428 self.0.encode(encoder, offset + 0, depth)?;
432 Ok(())
433 }
434 }
435
436 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for GpuUsage {
437 #[inline(always)]
438 fn new_empty() -> Self {
439 Self { interval_ms: fidl::new_empty!(u32, D) }
440 }
441
442 #[inline]
443 unsafe fn decode(
444 &mut self,
445 decoder: &mut fidl::encoding::Decoder<'_, D>,
446 offset: usize,
447 _depth: fidl::encoding::Depth,
448 ) -> fidl::Result<()> {
449 decoder.debug_check_bounds::<Self>(offset);
450 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
451 unsafe {
454 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
455 }
456 Ok(())
457 }
458 }
459
460 impl fidl::encoding::ValueTypeMarker for NetworkActivity {
461 type Borrowed<'a> = &'a Self;
462 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
463 value
464 }
465 }
466
467 unsafe impl fidl::encoding::TypeMarker for NetworkActivity {
468 type Owned = Self;
469
470 #[inline(always)]
471 fn inline_align(_context: fidl::encoding::Context) -> usize {
472 4
473 }
474
475 #[inline(always)]
476 fn inline_size(_context: fidl::encoding::Context) -> usize {
477 4
478 }
479 #[inline(always)]
480 fn encode_is_copy() -> bool {
481 true
482 }
483
484 #[inline(always)]
485 fn decode_is_copy() -> bool {
486 true
487 }
488 }
489
490 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NetworkActivity, D>
491 for &NetworkActivity
492 {
493 #[inline]
494 unsafe fn encode(
495 self,
496 encoder: &mut fidl::encoding::Encoder<'_, D>,
497 offset: usize,
498 _depth: fidl::encoding::Depth,
499 ) -> fidl::Result<()> {
500 encoder.debug_check_bounds::<NetworkActivity>(offset);
501 unsafe {
502 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
504 (buf_ptr as *mut NetworkActivity)
505 .write_unaligned((self as *const NetworkActivity).read());
506 }
509 Ok(())
510 }
511 }
512 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
513 fidl::encoding::Encode<NetworkActivity, D> for (T0,)
514 {
515 #[inline]
516 unsafe fn encode(
517 self,
518 encoder: &mut fidl::encoding::Encoder<'_, D>,
519 offset: usize,
520 depth: fidl::encoding::Depth,
521 ) -> fidl::Result<()> {
522 encoder.debug_check_bounds::<NetworkActivity>(offset);
523 self.0.encode(encoder, offset + 0, depth)?;
527 Ok(())
528 }
529 }
530
531 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NetworkActivity {
532 #[inline(always)]
533 fn new_empty() -> Self {
534 Self { interval_ms: fidl::new_empty!(u32, D) }
535 }
536
537 #[inline]
538 unsafe fn decode(
539 &mut self,
540 decoder: &mut fidl::encoding::Decoder<'_, D>,
541 offset: usize,
542 _depth: fidl::encoding::Depth,
543 ) -> fidl::Result<()> {
544 decoder.debug_check_bounds::<Self>(offset);
545 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
546 unsafe {
549 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
550 }
551 Ok(())
552 }
553 }
554
555 impl fidl::encoding::ValueTypeMarker for Power {
556 type Borrowed<'a> = &'a Self;
557 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
558 value
559 }
560 }
561
562 unsafe impl fidl::encoding::TypeMarker for Power {
563 type Owned = Self;
564
565 #[inline(always)]
566 fn inline_align(_context: fidl::encoding::Context) -> usize {
567 8
568 }
569
570 #[inline(always)]
571 fn inline_size(_context: fidl::encoding::Context) -> usize {
572 16
573 }
574 }
575
576 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Power, D> for &Power {
577 #[inline]
578 unsafe fn encode(
579 self,
580 encoder: &mut fidl::encoding::Encoder<'_, D>,
581 offset: usize,
582 _depth: fidl::encoding::Depth,
583 ) -> fidl::Result<()> {
584 encoder.debug_check_bounds::<Power>(offset);
585 fidl::encoding::Encode::<Power, D>::encode(
587 (
588 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.sampling_interval_ms),
589 <fidl::encoding::Boxed<StatisticsArgs> as fidl::encoding::ValueTypeMarker>::borrow(&self.statistics_args),
590 ),
591 encoder, offset, _depth
592 )
593 }
594 }
595 unsafe impl<
596 D: fidl::encoding::ResourceDialect,
597 T0: fidl::encoding::Encode<u32, D>,
598 T1: fidl::encoding::Encode<fidl::encoding::Boxed<StatisticsArgs>, D>,
599 > fidl::encoding::Encode<Power, D> for (T0, T1)
600 {
601 #[inline]
602 unsafe fn encode(
603 self,
604 encoder: &mut fidl::encoding::Encoder<'_, D>,
605 offset: usize,
606 depth: fidl::encoding::Depth,
607 ) -> fidl::Result<()> {
608 encoder.debug_check_bounds::<Power>(offset);
609 unsafe {
612 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
613 (ptr as *mut u64).write_unaligned(0);
614 }
615 self.0.encode(encoder, offset + 0, depth)?;
617 self.1.encode(encoder, offset + 8, depth)?;
618 Ok(())
619 }
620 }
621
622 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Power {
623 #[inline(always)]
624 fn new_empty() -> Self {
625 Self {
626 sampling_interval_ms: fidl::new_empty!(u32, D),
627 statistics_args: fidl::new_empty!(fidl::encoding::Boxed<StatisticsArgs>, D),
628 }
629 }
630
631 #[inline]
632 unsafe fn decode(
633 &mut self,
634 decoder: &mut fidl::encoding::Decoder<'_, D>,
635 offset: usize,
636 _depth: fidl::encoding::Depth,
637 ) -> fidl::Result<()> {
638 decoder.debug_check_bounds::<Self>(offset);
639 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
641 let padval = unsafe { (ptr as *const u64).read_unaligned() };
642 let mask = 0xffffffff00000000u64;
643 let maskedval = padval & mask;
644 if maskedval != 0 {
645 return Err(fidl::Error::NonZeroPadding {
646 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
647 });
648 }
649 fidl::decode!(u32, D, &mut self.sampling_interval_ms, decoder, offset + 0, _depth)?;
650 fidl::decode!(
651 fidl::encoding::Boxed<StatisticsArgs>,
652 D,
653 &mut self.statistics_args,
654 decoder,
655 offset + 8,
656 _depth
657 )?;
658 Ok(())
659 }
660 }
661
662 impl fidl::encoding::ValueTypeMarker for RecorderStartLoggingForeverRequest {
663 type Borrowed<'a> = &'a Self;
664 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
665 value
666 }
667 }
668
669 unsafe impl fidl::encoding::TypeMarker for RecorderStartLoggingForeverRequest {
670 type Owned = Self;
671
672 #[inline(always)]
673 fn inline_align(_context: fidl::encoding::Context) -> usize {
674 8
675 }
676
677 #[inline(always)]
678 fn inline_size(_context: fidl::encoding::Context) -> usize {
679 40
680 }
681 }
682
683 unsafe impl<D: fidl::encoding::ResourceDialect>
684 fidl::encoding::Encode<RecorderStartLoggingForeverRequest, D>
685 for &RecorderStartLoggingForeverRequest
686 {
687 #[inline]
688 unsafe fn encode(
689 self,
690 encoder: &mut fidl::encoding::Encoder<'_, D>,
691 offset: usize,
692 _depth: fidl::encoding::Depth,
693 ) -> fidl::Result<()> {
694 encoder.debug_check_bounds::<RecorderStartLoggingForeverRequest>(offset);
695 fidl::encoding::Encode::<RecorderStartLoggingForeverRequest, D>::encode(
697 (
698 <fidl::encoding::BoundedString<16> as fidl::encoding::ValueTypeMarker>::borrow(&self.client_id),
699 <fidl::encoding::UnboundedVector<Metric> as fidl::encoding::ValueTypeMarker>::borrow(&self.metrics),
700 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.output_samples_to_syslog),
701 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.output_stats_to_syslog),
702 ),
703 encoder, offset, _depth
704 )
705 }
706 }
707 unsafe impl<
708 D: fidl::encoding::ResourceDialect,
709 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<16>, D>,
710 T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<Metric>, D>,
711 T2: fidl::encoding::Encode<bool, D>,
712 T3: fidl::encoding::Encode<bool, D>,
713 > fidl::encoding::Encode<RecorderStartLoggingForeverRequest, D> for (T0, T1, T2, T3)
714 {
715 #[inline]
716 unsafe fn encode(
717 self,
718 encoder: &mut fidl::encoding::Encoder<'_, D>,
719 offset: usize,
720 depth: fidl::encoding::Depth,
721 ) -> fidl::Result<()> {
722 encoder.debug_check_bounds::<RecorderStartLoggingForeverRequest>(offset);
723 unsafe {
726 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
727 (ptr as *mut u64).write_unaligned(0);
728 }
729 self.0.encode(encoder, offset + 0, depth)?;
731 self.1.encode(encoder, offset + 16, depth)?;
732 self.2.encode(encoder, offset + 32, depth)?;
733 self.3.encode(encoder, offset + 33, depth)?;
734 Ok(())
735 }
736 }
737
738 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
739 for RecorderStartLoggingForeverRequest
740 {
741 #[inline(always)]
742 fn new_empty() -> Self {
743 Self {
744 client_id: fidl::new_empty!(fidl::encoding::BoundedString<16>, D),
745 metrics: fidl::new_empty!(fidl::encoding::UnboundedVector<Metric>, D),
746 output_samples_to_syslog: fidl::new_empty!(bool, D),
747 output_stats_to_syslog: fidl::new_empty!(bool, D),
748 }
749 }
750
751 #[inline]
752 unsafe fn decode(
753 &mut self,
754 decoder: &mut fidl::encoding::Decoder<'_, D>,
755 offset: usize,
756 _depth: fidl::encoding::Depth,
757 ) -> fidl::Result<()> {
758 decoder.debug_check_bounds::<Self>(offset);
759 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
761 let padval = unsafe { (ptr as *const u64).read_unaligned() };
762 let mask = 0xffffffffffff0000u64;
763 let maskedval = padval & mask;
764 if maskedval != 0 {
765 return Err(fidl::Error::NonZeroPadding {
766 padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
767 });
768 }
769 fidl::decode!(
770 fidl::encoding::BoundedString<16>,
771 D,
772 &mut self.client_id,
773 decoder,
774 offset + 0,
775 _depth
776 )?;
777 fidl::decode!(
778 fidl::encoding::UnboundedVector<Metric>,
779 D,
780 &mut self.metrics,
781 decoder,
782 offset + 16,
783 _depth
784 )?;
785 fidl::decode!(
786 bool,
787 D,
788 &mut self.output_samples_to_syslog,
789 decoder,
790 offset + 32,
791 _depth
792 )?;
793 fidl::decode!(bool, D, &mut self.output_stats_to_syslog, decoder, offset + 33, _depth)?;
794 Ok(())
795 }
796 }
797
798 impl fidl::encoding::ValueTypeMarker for RecorderStartLoggingRequest {
799 type Borrowed<'a> = &'a Self;
800 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
801 value
802 }
803 }
804
805 unsafe impl fidl::encoding::TypeMarker for RecorderStartLoggingRequest {
806 type Owned = Self;
807
808 #[inline(always)]
809 fn inline_align(_context: fidl::encoding::Context) -> usize {
810 8
811 }
812
813 #[inline(always)]
814 fn inline_size(_context: fidl::encoding::Context) -> usize {
815 40
816 }
817 }
818
819 unsafe impl<D: fidl::encoding::ResourceDialect>
820 fidl::encoding::Encode<RecorderStartLoggingRequest, D> for &RecorderStartLoggingRequest
821 {
822 #[inline]
823 unsafe fn encode(
824 self,
825 encoder: &mut fidl::encoding::Encoder<'_, D>,
826 offset: usize,
827 _depth: fidl::encoding::Depth,
828 ) -> fidl::Result<()> {
829 encoder.debug_check_bounds::<RecorderStartLoggingRequest>(offset);
830 fidl::encoding::Encode::<RecorderStartLoggingRequest, D>::encode(
832 (
833 <fidl::encoding::BoundedString<16> as fidl::encoding::ValueTypeMarker>::borrow(&self.client_id),
834 <fidl::encoding::UnboundedVector<Metric> as fidl::encoding::ValueTypeMarker>::borrow(&self.metrics),
835 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.duration_ms),
836 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.output_samples_to_syslog),
837 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.output_stats_to_syslog),
838 ),
839 encoder, offset, _depth
840 )
841 }
842 }
843 unsafe impl<
844 D: fidl::encoding::ResourceDialect,
845 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<16>, D>,
846 T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<Metric>, D>,
847 T2: fidl::encoding::Encode<u32, D>,
848 T3: fidl::encoding::Encode<bool, D>,
849 T4: fidl::encoding::Encode<bool, D>,
850 > fidl::encoding::Encode<RecorderStartLoggingRequest, D> for (T0, T1, T2, T3, T4)
851 {
852 #[inline]
853 unsafe fn encode(
854 self,
855 encoder: &mut fidl::encoding::Encoder<'_, D>,
856 offset: usize,
857 depth: fidl::encoding::Depth,
858 ) -> fidl::Result<()> {
859 encoder.debug_check_bounds::<RecorderStartLoggingRequest>(offset);
860 unsafe {
863 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
864 (ptr as *mut u64).write_unaligned(0);
865 }
866 self.0.encode(encoder, offset + 0, depth)?;
868 self.1.encode(encoder, offset + 16, depth)?;
869 self.2.encode(encoder, offset + 32, depth)?;
870 self.3.encode(encoder, offset + 36, depth)?;
871 self.4.encode(encoder, offset + 37, depth)?;
872 Ok(())
873 }
874 }
875
876 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
877 for RecorderStartLoggingRequest
878 {
879 #[inline(always)]
880 fn new_empty() -> Self {
881 Self {
882 client_id: fidl::new_empty!(fidl::encoding::BoundedString<16>, D),
883 metrics: fidl::new_empty!(fidl::encoding::UnboundedVector<Metric>, D),
884 duration_ms: fidl::new_empty!(u32, D),
885 output_samples_to_syslog: fidl::new_empty!(bool, D),
886 output_stats_to_syslog: fidl::new_empty!(bool, D),
887 }
888 }
889
890 #[inline]
891 unsafe fn decode(
892 &mut self,
893 decoder: &mut fidl::encoding::Decoder<'_, D>,
894 offset: usize,
895 _depth: fidl::encoding::Depth,
896 ) -> fidl::Result<()> {
897 decoder.debug_check_bounds::<Self>(offset);
898 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
900 let padval = unsafe { (ptr as *const u64).read_unaligned() };
901 let mask = 0xffff000000000000u64;
902 let maskedval = padval & mask;
903 if maskedval != 0 {
904 return Err(fidl::Error::NonZeroPadding {
905 padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
906 });
907 }
908 fidl::decode!(
909 fidl::encoding::BoundedString<16>,
910 D,
911 &mut self.client_id,
912 decoder,
913 offset + 0,
914 _depth
915 )?;
916 fidl::decode!(
917 fidl::encoding::UnboundedVector<Metric>,
918 D,
919 &mut self.metrics,
920 decoder,
921 offset + 16,
922 _depth
923 )?;
924 fidl::decode!(u32, D, &mut self.duration_ms, decoder, offset + 32, _depth)?;
925 fidl::decode!(
926 bool,
927 D,
928 &mut self.output_samples_to_syslog,
929 decoder,
930 offset + 36,
931 _depth
932 )?;
933 fidl::decode!(bool, D, &mut self.output_stats_to_syslog, decoder, offset + 37, _depth)?;
934 Ok(())
935 }
936 }
937
938 impl fidl::encoding::ValueTypeMarker for RecorderStopLoggingRequest {
939 type Borrowed<'a> = &'a Self;
940 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
941 value
942 }
943 }
944
945 unsafe impl fidl::encoding::TypeMarker for RecorderStopLoggingRequest {
946 type Owned = Self;
947
948 #[inline(always)]
949 fn inline_align(_context: fidl::encoding::Context) -> usize {
950 8
951 }
952
953 #[inline(always)]
954 fn inline_size(_context: fidl::encoding::Context) -> usize {
955 16
956 }
957 }
958
959 unsafe impl<D: fidl::encoding::ResourceDialect>
960 fidl::encoding::Encode<RecorderStopLoggingRequest, D> for &RecorderStopLoggingRequest
961 {
962 #[inline]
963 unsafe fn encode(
964 self,
965 encoder: &mut fidl::encoding::Encoder<'_, D>,
966 offset: usize,
967 _depth: fidl::encoding::Depth,
968 ) -> fidl::Result<()> {
969 encoder.debug_check_bounds::<RecorderStopLoggingRequest>(offset);
970 fidl::encoding::Encode::<RecorderStopLoggingRequest, D>::encode(
972 (<fidl::encoding::BoundedString<16> as fidl::encoding::ValueTypeMarker>::borrow(
973 &self.client_id,
974 ),),
975 encoder,
976 offset,
977 _depth,
978 )
979 }
980 }
981 unsafe impl<
982 D: fidl::encoding::ResourceDialect,
983 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<16>, D>,
984 > fidl::encoding::Encode<RecorderStopLoggingRequest, D> for (T0,)
985 {
986 #[inline]
987 unsafe fn encode(
988 self,
989 encoder: &mut fidl::encoding::Encoder<'_, D>,
990 offset: usize,
991 depth: fidl::encoding::Depth,
992 ) -> fidl::Result<()> {
993 encoder.debug_check_bounds::<RecorderStopLoggingRequest>(offset);
994 self.0.encode(encoder, offset + 0, depth)?;
998 Ok(())
999 }
1000 }
1001
1002 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1003 for RecorderStopLoggingRequest
1004 {
1005 #[inline(always)]
1006 fn new_empty() -> Self {
1007 Self { client_id: fidl::new_empty!(fidl::encoding::BoundedString<16>, D) }
1008 }
1009
1010 #[inline]
1011 unsafe fn decode(
1012 &mut self,
1013 decoder: &mut fidl::encoding::Decoder<'_, D>,
1014 offset: usize,
1015 _depth: fidl::encoding::Depth,
1016 ) -> fidl::Result<()> {
1017 decoder.debug_check_bounds::<Self>(offset);
1018 fidl::decode!(
1020 fidl::encoding::BoundedString<16>,
1021 D,
1022 &mut self.client_id,
1023 decoder,
1024 offset + 0,
1025 _depth
1026 )?;
1027 Ok(())
1028 }
1029 }
1030
1031 impl fidl::encoding::ValueTypeMarker for RecorderStopLoggingResponse {
1032 type Borrowed<'a> = &'a Self;
1033 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1034 value
1035 }
1036 }
1037
1038 unsafe impl fidl::encoding::TypeMarker for RecorderStopLoggingResponse {
1039 type Owned = Self;
1040
1041 #[inline(always)]
1042 fn inline_align(_context: fidl::encoding::Context) -> usize {
1043 1
1044 }
1045
1046 #[inline(always)]
1047 fn inline_size(_context: fidl::encoding::Context) -> usize {
1048 1
1049 }
1050 }
1051
1052 unsafe impl<D: fidl::encoding::ResourceDialect>
1053 fidl::encoding::Encode<RecorderStopLoggingResponse, D> for &RecorderStopLoggingResponse
1054 {
1055 #[inline]
1056 unsafe fn encode(
1057 self,
1058 encoder: &mut fidl::encoding::Encoder<'_, D>,
1059 offset: usize,
1060 _depth: fidl::encoding::Depth,
1061 ) -> fidl::Result<()> {
1062 encoder.debug_check_bounds::<RecorderStopLoggingResponse>(offset);
1063 fidl::encoding::Encode::<RecorderStopLoggingResponse, D>::encode(
1065 (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.stopped),),
1066 encoder,
1067 offset,
1068 _depth,
1069 )
1070 }
1071 }
1072 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
1073 fidl::encoding::Encode<RecorderStopLoggingResponse, D> for (T0,)
1074 {
1075 #[inline]
1076 unsafe fn encode(
1077 self,
1078 encoder: &mut fidl::encoding::Encoder<'_, D>,
1079 offset: usize,
1080 depth: fidl::encoding::Depth,
1081 ) -> fidl::Result<()> {
1082 encoder.debug_check_bounds::<RecorderStopLoggingResponse>(offset);
1083 self.0.encode(encoder, offset + 0, depth)?;
1087 Ok(())
1088 }
1089 }
1090
1091 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1092 for RecorderStopLoggingResponse
1093 {
1094 #[inline(always)]
1095 fn new_empty() -> Self {
1096 Self { stopped: fidl::new_empty!(bool, D) }
1097 }
1098
1099 #[inline]
1100 unsafe fn decode(
1101 &mut self,
1102 decoder: &mut fidl::encoding::Decoder<'_, D>,
1103 offset: usize,
1104 _depth: fidl::encoding::Depth,
1105 ) -> fidl::Result<()> {
1106 decoder.debug_check_bounds::<Self>(offset);
1107 fidl::decode!(bool, D, &mut self.stopped, decoder, offset + 0, _depth)?;
1109 Ok(())
1110 }
1111 }
1112
1113 impl fidl::encoding::ValueTypeMarker for StatisticsArgs {
1114 type Borrowed<'a> = &'a Self;
1115 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1116 value
1117 }
1118 }
1119
1120 unsafe impl fidl::encoding::TypeMarker for StatisticsArgs {
1121 type Owned = Self;
1122
1123 #[inline(always)]
1124 fn inline_align(_context: fidl::encoding::Context) -> usize {
1125 4
1126 }
1127
1128 #[inline(always)]
1129 fn inline_size(_context: fidl::encoding::Context) -> usize {
1130 4
1131 }
1132 #[inline(always)]
1133 fn encode_is_copy() -> bool {
1134 true
1135 }
1136
1137 #[inline(always)]
1138 fn decode_is_copy() -> bool {
1139 true
1140 }
1141 }
1142
1143 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StatisticsArgs, D>
1144 for &StatisticsArgs
1145 {
1146 #[inline]
1147 unsafe fn encode(
1148 self,
1149 encoder: &mut fidl::encoding::Encoder<'_, D>,
1150 offset: usize,
1151 _depth: fidl::encoding::Depth,
1152 ) -> fidl::Result<()> {
1153 encoder.debug_check_bounds::<StatisticsArgs>(offset);
1154 unsafe {
1155 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1157 (buf_ptr as *mut StatisticsArgs)
1158 .write_unaligned((self as *const StatisticsArgs).read());
1159 }
1162 Ok(())
1163 }
1164 }
1165 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
1166 fidl::encoding::Encode<StatisticsArgs, D> for (T0,)
1167 {
1168 #[inline]
1169 unsafe fn encode(
1170 self,
1171 encoder: &mut fidl::encoding::Encoder<'_, D>,
1172 offset: usize,
1173 depth: fidl::encoding::Depth,
1174 ) -> fidl::Result<()> {
1175 encoder.debug_check_bounds::<StatisticsArgs>(offset);
1176 self.0.encode(encoder, offset + 0, depth)?;
1180 Ok(())
1181 }
1182 }
1183
1184 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StatisticsArgs {
1185 #[inline(always)]
1186 fn new_empty() -> Self {
1187 Self { statistics_interval_ms: fidl::new_empty!(u32, D) }
1188 }
1189
1190 #[inline]
1191 unsafe fn decode(
1192 &mut self,
1193 decoder: &mut fidl::encoding::Decoder<'_, D>,
1194 offset: usize,
1195 _depth: fidl::encoding::Depth,
1196 ) -> fidl::Result<()> {
1197 decoder.debug_check_bounds::<Self>(offset);
1198 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1199 unsafe {
1202 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
1203 }
1204 Ok(())
1205 }
1206 }
1207
1208 impl fidl::encoding::ValueTypeMarker for Temperature {
1209 type Borrowed<'a> = &'a Self;
1210 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1211 value
1212 }
1213 }
1214
1215 unsafe impl fidl::encoding::TypeMarker for Temperature {
1216 type Owned = Self;
1217
1218 #[inline(always)]
1219 fn inline_align(_context: fidl::encoding::Context) -> usize {
1220 8
1221 }
1222
1223 #[inline(always)]
1224 fn inline_size(_context: fidl::encoding::Context) -> usize {
1225 16
1226 }
1227 }
1228
1229 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Temperature, D>
1230 for &Temperature
1231 {
1232 #[inline]
1233 unsafe fn encode(
1234 self,
1235 encoder: &mut fidl::encoding::Encoder<'_, D>,
1236 offset: usize,
1237 _depth: fidl::encoding::Depth,
1238 ) -> fidl::Result<()> {
1239 encoder.debug_check_bounds::<Temperature>(offset);
1240 fidl::encoding::Encode::<Temperature, D>::encode(
1242 (
1243 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.sampling_interval_ms),
1244 <fidl::encoding::Boxed<StatisticsArgs> as fidl::encoding::ValueTypeMarker>::borrow(&self.statistics_args),
1245 ),
1246 encoder, offset, _depth
1247 )
1248 }
1249 }
1250 unsafe impl<
1251 D: fidl::encoding::ResourceDialect,
1252 T0: fidl::encoding::Encode<u32, D>,
1253 T1: fidl::encoding::Encode<fidl::encoding::Boxed<StatisticsArgs>, D>,
1254 > fidl::encoding::Encode<Temperature, D> for (T0, T1)
1255 {
1256 #[inline]
1257 unsafe fn encode(
1258 self,
1259 encoder: &mut fidl::encoding::Encoder<'_, D>,
1260 offset: usize,
1261 depth: fidl::encoding::Depth,
1262 ) -> fidl::Result<()> {
1263 encoder.debug_check_bounds::<Temperature>(offset);
1264 unsafe {
1267 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1268 (ptr as *mut u64).write_unaligned(0);
1269 }
1270 self.0.encode(encoder, offset + 0, depth)?;
1272 self.1.encode(encoder, offset + 8, depth)?;
1273 Ok(())
1274 }
1275 }
1276
1277 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Temperature {
1278 #[inline(always)]
1279 fn new_empty() -> Self {
1280 Self {
1281 sampling_interval_ms: fidl::new_empty!(u32, D),
1282 statistics_args: fidl::new_empty!(fidl::encoding::Boxed<StatisticsArgs>, D),
1283 }
1284 }
1285
1286 #[inline]
1287 unsafe fn decode(
1288 &mut self,
1289 decoder: &mut fidl::encoding::Decoder<'_, D>,
1290 offset: usize,
1291 _depth: fidl::encoding::Depth,
1292 ) -> fidl::Result<()> {
1293 decoder.debug_check_bounds::<Self>(offset);
1294 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1296 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1297 let mask = 0xffffffff00000000u64;
1298 let maskedval = padval & mask;
1299 if maskedval != 0 {
1300 return Err(fidl::Error::NonZeroPadding {
1301 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1302 });
1303 }
1304 fidl::decode!(u32, D, &mut self.sampling_interval_ms, decoder, offset + 0, _depth)?;
1305 fidl::decode!(
1306 fidl::encoding::Boxed<StatisticsArgs>,
1307 D,
1308 &mut self.statistics_args,
1309 decoder,
1310 offset + 8,
1311 _depth
1312 )?;
1313 Ok(())
1314 }
1315 }
1316
1317 impl fidl::encoding::ValueTypeMarker for Metric {
1318 type Borrowed<'a> = &'a Self;
1319 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1320 value
1321 }
1322 }
1323
1324 unsafe impl fidl::encoding::TypeMarker for Metric {
1325 type Owned = Self;
1326
1327 #[inline(always)]
1328 fn inline_align(_context: fidl::encoding::Context) -> usize {
1329 8
1330 }
1331
1332 #[inline(always)]
1333 fn inline_size(_context: fidl::encoding::Context) -> usize {
1334 16
1335 }
1336 }
1337
1338 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Metric, D> for &Metric {
1339 #[inline]
1340 unsafe fn encode(
1341 self,
1342 encoder: &mut fidl::encoding::Encoder<'_, D>,
1343 offset: usize,
1344 _depth: fidl::encoding::Depth,
1345 ) -> fidl::Result<()> {
1346 encoder.debug_check_bounds::<Metric>(offset);
1347 encoder.write_num::<u64>(self.ordinal(), offset);
1348 match self {
1349 Metric::Temperature(ref val) => {
1350 fidl::encoding::encode_in_envelope::<Temperature, D>(
1351 <Temperature as fidl::encoding::ValueTypeMarker>::borrow(val),
1352 encoder,
1353 offset + 8,
1354 _depth,
1355 )
1356 }
1357 Metric::CpuLoad(ref val) => fidl::encoding::encode_in_envelope::<CpuLoad, D>(
1358 <CpuLoad as fidl::encoding::ValueTypeMarker>::borrow(val),
1359 encoder,
1360 offset + 8,
1361 _depth,
1362 ),
1363 Metric::Power(ref val) => fidl::encoding::encode_in_envelope::<Power, D>(
1364 <Power as fidl::encoding::ValueTypeMarker>::borrow(val),
1365 encoder,
1366 offset + 8,
1367 _depth,
1368 ),
1369 Metric::GpuUsage(ref val) => fidl::encoding::encode_in_envelope::<GpuUsage, D>(
1370 <GpuUsage as fidl::encoding::ValueTypeMarker>::borrow(val),
1371 encoder,
1372 offset + 8,
1373 _depth,
1374 ),
1375 Metric::NetworkActivity(ref val) => {
1376 fidl::encoding::encode_in_envelope::<NetworkActivity, D>(
1377 <NetworkActivity as fidl::encoding::ValueTypeMarker>::borrow(val),
1378 encoder,
1379 offset + 8,
1380 _depth,
1381 )
1382 }
1383 }
1384 }
1385 }
1386
1387 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Metric {
1388 #[inline(always)]
1389 fn new_empty() -> Self {
1390 Self::Temperature(fidl::new_empty!(Temperature, D))
1391 }
1392
1393 #[inline]
1394 unsafe fn decode(
1395 &mut self,
1396 decoder: &mut fidl::encoding::Decoder<'_, D>,
1397 offset: usize,
1398 mut depth: fidl::encoding::Depth,
1399 ) -> fidl::Result<()> {
1400 decoder.debug_check_bounds::<Self>(offset);
1401 #[allow(unused_variables)]
1402 let next_out_of_line = decoder.next_out_of_line();
1403 let handles_before = decoder.remaining_handles();
1404 let (ordinal, inlined, num_bytes, num_handles) =
1405 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
1406
1407 let member_inline_size = match ordinal {
1408 1 => <Temperature as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1409 2 => <CpuLoad as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1410 3 => <Power as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1411 4 => <GpuUsage as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1412 5 => <NetworkActivity as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1413 _ => return Err(fidl::Error::UnknownUnionTag),
1414 };
1415
1416 if inlined != (member_inline_size <= 4) {
1417 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1418 }
1419 let _inner_offset;
1420 if inlined {
1421 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
1422 _inner_offset = offset + 8;
1423 } else {
1424 depth.increment()?;
1425 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1426 }
1427 match ordinal {
1428 1 => {
1429 #[allow(irrefutable_let_patterns)]
1430 if let Metric::Temperature(_) = self {
1431 } else {
1433 *self = Metric::Temperature(fidl::new_empty!(Temperature, D));
1435 }
1436 #[allow(irrefutable_let_patterns)]
1437 if let Metric::Temperature(ref mut val) = self {
1438 fidl::decode!(Temperature, D, val, decoder, _inner_offset, depth)?;
1439 } else {
1440 unreachable!()
1441 }
1442 }
1443 2 => {
1444 #[allow(irrefutable_let_patterns)]
1445 if let Metric::CpuLoad(_) = self {
1446 } else {
1448 *self = Metric::CpuLoad(fidl::new_empty!(CpuLoad, D));
1450 }
1451 #[allow(irrefutable_let_patterns)]
1452 if let Metric::CpuLoad(ref mut val) = self {
1453 fidl::decode!(CpuLoad, D, val, decoder, _inner_offset, depth)?;
1454 } else {
1455 unreachable!()
1456 }
1457 }
1458 3 => {
1459 #[allow(irrefutable_let_patterns)]
1460 if let Metric::Power(_) = self {
1461 } else {
1463 *self = Metric::Power(fidl::new_empty!(Power, D));
1465 }
1466 #[allow(irrefutable_let_patterns)]
1467 if let Metric::Power(ref mut val) = self {
1468 fidl::decode!(Power, D, val, decoder, _inner_offset, depth)?;
1469 } else {
1470 unreachable!()
1471 }
1472 }
1473 4 => {
1474 #[allow(irrefutable_let_patterns)]
1475 if let Metric::GpuUsage(_) = self {
1476 } else {
1478 *self = Metric::GpuUsage(fidl::new_empty!(GpuUsage, D));
1480 }
1481 #[allow(irrefutable_let_patterns)]
1482 if let Metric::GpuUsage(ref mut val) = self {
1483 fidl::decode!(GpuUsage, D, val, decoder, _inner_offset, depth)?;
1484 } else {
1485 unreachable!()
1486 }
1487 }
1488 5 => {
1489 #[allow(irrefutable_let_patterns)]
1490 if let Metric::NetworkActivity(_) = self {
1491 } else {
1493 *self = Metric::NetworkActivity(fidl::new_empty!(NetworkActivity, D));
1495 }
1496 #[allow(irrefutable_let_patterns)]
1497 if let Metric::NetworkActivity(ref mut val) = self {
1498 fidl::decode!(NetworkActivity, D, val, decoder, _inner_offset, depth)?;
1499 } else {
1500 unreachable!()
1501 }
1502 }
1503 ordinal => panic!("unexpected ordinal {:?}", ordinal),
1504 }
1505 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
1506 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1507 }
1508 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1509 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1510 }
1511 Ok(())
1512 }
1513 }
1514}