fidl_fuchsia_cobalt_common/
fidl_fuchsia_cobalt_common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![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
11#[derive(Clone, Debug, PartialEq)]
12pub struct ControllerGenerateAggregatedObservationsRequest {
13    pub day_index: u32,
14    pub report_specs: Vec<ReportSpec>,
15}
16
17impl fidl::Persistable for ControllerGenerateAggregatedObservationsRequest {}
18
19#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
20pub struct ControllerGenerateAggregatedObservationsResponse {
21    pub num_obs: Vec<u64>,
22}
23
24impl fidl::Persistable for ControllerGenerateAggregatedObservationsResponse {}
25
26#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
27pub struct ControllerRequestSendSoonResponse {
28    pub success: bool,
29}
30
31impl fidl::Persistable for ControllerRequestSendSoonResponse {}
32
33/// A specification to identify a single Cobalt report.
34#[derive(Clone, Debug, Default, PartialEq)]
35pub struct ReportSpec {
36    /// The customer ID, as specified in Cobalt's metrics registry.
37    pub customer_id: Option<u32>,
38    /// The ID of the project, as specified in Cobalt's metrics registry.
39    pub project_id: Option<u32>,
40    /// The ID of the metric, as specified in Cobalt's metrics registry.
41    pub metric_id: Option<u32>,
42    /// The ID of the report, as specified in Cobalt's metrics registry.
43    pub report_id: Option<u32>,
44    #[doc(hidden)]
45    pub __source_breaking: fidl::marker::SourceBreaking,
46}
47
48impl fidl::Persistable for ReportSpec {}
49
50mod internal {
51    use super::*;
52
53    impl fidl::encoding::ValueTypeMarker for ControllerGenerateAggregatedObservationsRequest {
54        type Borrowed<'a> = &'a Self;
55        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
56            value
57        }
58    }
59
60    unsafe impl fidl::encoding::TypeMarker for ControllerGenerateAggregatedObservationsRequest {
61        type Owned = Self;
62
63        #[inline(always)]
64        fn inline_align(_context: fidl::encoding::Context) -> usize {
65            8
66        }
67
68        #[inline(always)]
69        fn inline_size(_context: fidl::encoding::Context) -> usize {
70            24
71        }
72    }
73
74    unsafe impl<D: fidl::encoding::ResourceDialect>
75        fidl::encoding::Encode<ControllerGenerateAggregatedObservationsRequest, D>
76        for &ControllerGenerateAggregatedObservationsRequest
77    {
78        #[inline]
79        unsafe fn encode(
80            self,
81            encoder: &mut fidl::encoding::Encoder<'_, D>,
82            offset: usize,
83            _depth: fidl::encoding::Depth,
84        ) -> fidl::Result<()> {
85            encoder.debug_check_bounds::<ControllerGenerateAggregatedObservationsRequest>(offset);
86            // Delegate to tuple encoding.
87            fidl::encoding::Encode::<ControllerGenerateAggregatedObservationsRequest, D>::encode(
88                (
89                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.day_index),
90                    <fidl::encoding::UnboundedVector<ReportSpec> as fidl::encoding::ValueTypeMarker>::borrow(&self.report_specs),
91                ),
92                encoder, offset, _depth
93            )
94        }
95    }
96    unsafe impl<
97            D: fidl::encoding::ResourceDialect,
98            T0: fidl::encoding::Encode<u32, D>,
99            T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<ReportSpec>, D>,
100        > fidl::encoding::Encode<ControllerGenerateAggregatedObservationsRequest, D> for (T0, T1)
101    {
102        #[inline]
103        unsafe fn encode(
104            self,
105            encoder: &mut fidl::encoding::Encoder<'_, D>,
106            offset: usize,
107            depth: fidl::encoding::Depth,
108        ) -> fidl::Result<()> {
109            encoder.debug_check_bounds::<ControllerGenerateAggregatedObservationsRequest>(offset);
110            // Zero out padding regions. There's no need to apply masks
111            // because the unmasked parts will be overwritten by fields.
112            unsafe {
113                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
114                (ptr as *mut u64).write_unaligned(0);
115            }
116            // Write the fields.
117            self.0.encode(encoder, offset + 0, depth)?;
118            self.1.encode(encoder, offset + 8, depth)?;
119            Ok(())
120        }
121    }
122
123    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
124        for ControllerGenerateAggregatedObservationsRequest
125    {
126        #[inline(always)]
127        fn new_empty() -> Self {
128            Self {
129                day_index: fidl::new_empty!(u32, D),
130                report_specs: fidl::new_empty!(fidl::encoding::UnboundedVector<ReportSpec>, D),
131            }
132        }
133
134        #[inline]
135        unsafe fn decode(
136            &mut self,
137            decoder: &mut fidl::encoding::Decoder<'_, D>,
138            offset: usize,
139            _depth: fidl::encoding::Depth,
140        ) -> fidl::Result<()> {
141            decoder.debug_check_bounds::<Self>(offset);
142            // Verify that padding bytes are zero.
143            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
144            let padval = unsafe { (ptr as *const u64).read_unaligned() };
145            let mask = 0xffffffff00000000u64;
146            let maskedval = padval & mask;
147            if maskedval != 0 {
148                return Err(fidl::Error::NonZeroPadding {
149                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
150                });
151            }
152            fidl::decode!(u32, D, &mut self.day_index, decoder, offset + 0, _depth)?;
153            fidl::decode!(
154                fidl::encoding::UnboundedVector<ReportSpec>,
155                D,
156                &mut self.report_specs,
157                decoder,
158                offset + 8,
159                _depth
160            )?;
161            Ok(())
162        }
163    }
164
165    impl fidl::encoding::ValueTypeMarker for ControllerGenerateAggregatedObservationsResponse {
166        type Borrowed<'a> = &'a Self;
167        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
168            value
169        }
170    }
171
172    unsafe impl fidl::encoding::TypeMarker for ControllerGenerateAggregatedObservationsResponse {
173        type Owned = Self;
174
175        #[inline(always)]
176        fn inline_align(_context: fidl::encoding::Context) -> usize {
177            8
178        }
179
180        #[inline(always)]
181        fn inline_size(_context: fidl::encoding::Context) -> usize {
182            16
183        }
184    }
185
186    unsafe impl<D: fidl::encoding::ResourceDialect>
187        fidl::encoding::Encode<ControllerGenerateAggregatedObservationsResponse, D>
188        for &ControllerGenerateAggregatedObservationsResponse
189    {
190        #[inline]
191        unsafe fn encode(
192            self,
193            encoder: &mut fidl::encoding::Encoder<'_, D>,
194            offset: usize,
195            _depth: fidl::encoding::Depth,
196        ) -> fidl::Result<()> {
197            encoder.debug_check_bounds::<ControllerGenerateAggregatedObservationsResponse>(offset);
198            // Delegate to tuple encoding.
199            fidl::encoding::Encode::<ControllerGenerateAggregatedObservationsResponse, D>::encode(
200                (
201                    <fidl::encoding::UnboundedVector<u64> as fidl::encoding::ValueTypeMarker>::borrow(&self.num_obs),
202                ),
203                encoder, offset, _depth
204            )
205        }
206    }
207    unsafe impl<
208            D: fidl::encoding::ResourceDialect,
209            T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u64>, D>,
210        > fidl::encoding::Encode<ControllerGenerateAggregatedObservationsResponse, D> for (T0,)
211    {
212        #[inline]
213        unsafe fn encode(
214            self,
215            encoder: &mut fidl::encoding::Encoder<'_, D>,
216            offset: usize,
217            depth: fidl::encoding::Depth,
218        ) -> fidl::Result<()> {
219            encoder.debug_check_bounds::<ControllerGenerateAggregatedObservationsResponse>(offset);
220            // Zero out padding regions. There's no need to apply masks
221            // because the unmasked parts will be overwritten by fields.
222            // Write the fields.
223            self.0.encode(encoder, offset + 0, depth)?;
224            Ok(())
225        }
226    }
227
228    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
229        for ControllerGenerateAggregatedObservationsResponse
230    {
231        #[inline(always)]
232        fn new_empty() -> Self {
233            Self { num_obs: fidl::new_empty!(fidl::encoding::UnboundedVector<u64>, D) }
234        }
235
236        #[inline]
237        unsafe fn decode(
238            &mut self,
239            decoder: &mut fidl::encoding::Decoder<'_, D>,
240            offset: usize,
241            _depth: fidl::encoding::Depth,
242        ) -> fidl::Result<()> {
243            decoder.debug_check_bounds::<Self>(offset);
244            // Verify that padding bytes are zero.
245            fidl::decode!(
246                fidl::encoding::UnboundedVector<u64>,
247                D,
248                &mut self.num_obs,
249                decoder,
250                offset + 0,
251                _depth
252            )?;
253            Ok(())
254        }
255    }
256
257    impl fidl::encoding::ValueTypeMarker for ControllerRequestSendSoonResponse {
258        type Borrowed<'a> = &'a Self;
259        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
260            value
261        }
262    }
263
264    unsafe impl fidl::encoding::TypeMarker for ControllerRequestSendSoonResponse {
265        type Owned = Self;
266
267        #[inline(always)]
268        fn inline_align(_context: fidl::encoding::Context) -> usize {
269            1
270        }
271
272        #[inline(always)]
273        fn inline_size(_context: fidl::encoding::Context) -> usize {
274            1
275        }
276    }
277
278    unsafe impl<D: fidl::encoding::ResourceDialect>
279        fidl::encoding::Encode<ControllerRequestSendSoonResponse, D>
280        for &ControllerRequestSendSoonResponse
281    {
282        #[inline]
283        unsafe fn encode(
284            self,
285            encoder: &mut fidl::encoding::Encoder<'_, D>,
286            offset: usize,
287            _depth: fidl::encoding::Depth,
288        ) -> fidl::Result<()> {
289            encoder.debug_check_bounds::<ControllerRequestSendSoonResponse>(offset);
290            // Delegate to tuple encoding.
291            fidl::encoding::Encode::<ControllerRequestSendSoonResponse, D>::encode(
292                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.success),),
293                encoder,
294                offset,
295                _depth,
296            )
297        }
298    }
299    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
300        fidl::encoding::Encode<ControllerRequestSendSoonResponse, D> for (T0,)
301    {
302        #[inline]
303        unsafe fn encode(
304            self,
305            encoder: &mut fidl::encoding::Encoder<'_, D>,
306            offset: usize,
307            depth: fidl::encoding::Depth,
308        ) -> fidl::Result<()> {
309            encoder.debug_check_bounds::<ControllerRequestSendSoonResponse>(offset);
310            // Zero out padding regions. There's no need to apply masks
311            // because the unmasked parts will be overwritten by fields.
312            // Write the fields.
313            self.0.encode(encoder, offset + 0, depth)?;
314            Ok(())
315        }
316    }
317
318    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
319        for ControllerRequestSendSoonResponse
320    {
321        #[inline(always)]
322        fn new_empty() -> Self {
323            Self { success: fidl::new_empty!(bool, D) }
324        }
325
326        #[inline]
327        unsafe fn decode(
328            &mut self,
329            decoder: &mut fidl::encoding::Decoder<'_, D>,
330            offset: usize,
331            _depth: fidl::encoding::Depth,
332        ) -> fidl::Result<()> {
333            decoder.debug_check_bounds::<Self>(offset);
334            // Verify that padding bytes are zero.
335            fidl::decode!(bool, D, &mut self.success, decoder, offset + 0, _depth)?;
336            Ok(())
337        }
338    }
339
340    impl ReportSpec {
341        #[inline(always)]
342        fn max_ordinal_present(&self) -> u64 {
343            if let Some(_) = self.report_id {
344                return 4;
345            }
346            if let Some(_) = self.metric_id {
347                return 3;
348            }
349            if let Some(_) = self.project_id {
350                return 2;
351            }
352            if let Some(_) = self.customer_id {
353                return 1;
354            }
355            0
356        }
357    }
358
359    impl fidl::encoding::ValueTypeMarker for ReportSpec {
360        type Borrowed<'a> = &'a Self;
361        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
362            value
363        }
364    }
365
366    unsafe impl fidl::encoding::TypeMarker for ReportSpec {
367        type Owned = Self;
368
369        #[inline(always)]
370        fn inline_align(_context: fidl::encoding::Context) -> usize {
371            8
372        }
373
374        #[inline(always)]
375        fn inline_size(_context: fidl::encoding::Context) -> usize {
376            16
377        }
378    }
379
380    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ReportSpec, D>
381        for &ReportSpec
382    {
383        unsafe fn encode(
384            self,
385            encoder: &mut fidl::encoding::Encoder<'_, D>,
386            offset: usize,
387            mut depth: fidl::encoding::Depth,
388        ) -> fidl::Result<()> {
389            encoder.debug_check_bounds::<ReportSpec>(offset);
390            // Vector header
391            let max_ordinal: u64 = self.max_ordinal_present();
392            encoder.write_num(max_ordinal, offset);
393            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
394            // Calling encoder.out_of_line_offset(0) is not allowed.
395            if max_ordinal == 0 {
396                return Ok(());
397            }
398            depth.increment()?;
399            let envelope_size = 8;
400            let bytes_len = max_ordinal as usize * envelope_size;
401            #[allow(unused_variables)]
402            let offset = encoder.out_of_line_offset(bytes_len);
403            let mut _prev_end_offset: usize = 0;
404            if 1 > max_ordinal {
405                return Ok(());
406            }
407
408            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
409            // are envelope_size bytes.
410            let cur_offset: usize = (1 - 1) * envelope_size;
411
412            // Zero reserved fields.
413            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
414
415            // Safety:
416            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
417            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
418            //   envelope_size bytes, there is always sufficient room.
419            fidl::encoding::encode_in_envelope_optional::<u32, D>(
420                self.customer_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
421                encoder,
422                offset + cur_offset,
423                depth,
424            )?;
425
426            _prev_end_offset = cur_offset + envelope_size;
427            if 2 > max_ordinal {
428                return Ok(());
429            }
430
431            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
432            // are envelope_size bytes.
433            let cur_offset: usize = (2 - 1) * envelope_size;
434
435            // Zero reserved fields.
436            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
437
438            // Safety:
439            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
440            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
441            //   envelope_size bytes, there is always sufficient room.
442            fidl::encoding::encode_in_envelope_optional::<u32, D>(
443                self.project_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
444                encoder,
445                offset + cur_offset,
446                depth,
447            )?;
448
449            _prev_end_offset = cur_offset + envelope_size;
450            if 3 > max_ordinal {
451                return Ok(());
452            }
453
454            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
455            // are envelope_size bytes.
456            let cur_offset: usize = (3 - 1) * envelope_size;
457
458            // Zero reserved fields.
459            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
460
461            // Safety:
462            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
463            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
464            //   envelope_size bytes, there is always sufficient room.
465            fidl::encoding::encode_in_envelope_optional::<u32, D>(
466                self.metric_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
467                encoder,
468                offset + cur_offset,
469                depth,
470            )?;
471
472            _prev_end_offset = cur_offset + envelope_size;
473            if 4 > max_ordinal {
474                return Ok(());
475            }
476
477            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
478            // are envelope_size bytes.
479            let cur_offset: usize = (4 - 1) * envelope_size;
480
481            // Zero reserved fields.
482            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
483
484            // Safety:
485            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
486            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
487            //   envelope_size bytes, there is always sufficient room.
488            fidl::encoding::encode_in_envelope_optional::<u32, D>(
489                self.report_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
490                encoder,
491                offset + cur_offset,
492                depth,
493            )?;
494
495            _prev_end_offset = cur_offset + envelope_size;
496
497            Ok(())
498        }
499    }
500
501    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ReportSpec {
502        #[inline(always)]
503        fn new_empty() -> Self {
504            Self::default()
505        }
506
507        unsafe fn decode(
508            &mut self,
509            decoder: &mut fidl::encoding::Decoder<'_, D>,
510            offset: usize,
511            mut depth: fidl::encoding::Depth,
512        ) -> fidl::Result<()> {
513            decoder.debug_check_bounds::<Self>(offset);
514            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
515                None => return Err(fidl::Error::NotNullable),
516                Some(len) => len,
517            };
518            // Calling decoder.out_of_line_offset(0) is not allowed.
519            if len == 0 {
520                return Ok(());
521            };
522            depth.increment()?;
523            let envelope_size = 8;
524            let bytes_len = len * envelope_size;
525            let offset = decoder.out_of_line_offset(bytes_len)?;
526            // Decode the envelope for each type.
527            let mut _next_ordinal_to_read = 0;
528            let mut next_offset = offset;
529            let end_offset = offset + bytes_len;
530            _next_ordinal_to_read += 1;
531            if next_offset >= end_offset {
532                return Ok(());
533            }
534
535            // Decode unknown envelopes for gaps in ordinals.
536            while _next_ordinal_to_read < 1 {
537                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
538                _next_ordinal_to_read += 1;
539                next_offset += envelope_size;
540            }
541
542            let next_out_of_line = decoder.next_out_of_line();
543            let handles_before = decoder.remaining_handles();
544            if let Some((inlined, num_bytes, num_handles)) =
545                fidl::encoding::decode_envelope_header(decoder, next_offset)?
546            {
547                let member_inline_size =
548                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
549                if inlined != (member_inline_size <= 4) {
550                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
551                }
552                let inner_offset;
553                let mut inner_depth = depth.clone();
554                if inlined {
555                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
556                    inner_offset = next_offset;
557                } else {
558                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
559                    inner_depth.increment()?;
560                }
561                let val_ref = self.customer_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
562                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
563                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
564                {
565                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
566                }
567                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
568                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
569                }
570            }
571
572            next_offset += envelope_size;
573            _next_ordinal_to_read += 1;
574            if next_offset >= end_offset {
575                return Ok(());
576            }
577
578            // Decode unknown envelopes for gaps in ordinals.
579            while _next_ordinal_to_read < 2 {
580                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
581                _next_ordinal_to_read += 1;
582                next_offset += envelope_size;
583            }
584
585            let next_out_of_line = decoder.next_out_of_line();
586            let handles_before = decoder.remaining_handles();
587            if let Some((inlined, num_bytes, num_handles)) =
588                fidl::encoding::decode_envelope_header(decoder, next_offset)?
589            {
590                let member_inline_size =
591                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
592                if inlined != (member_inline_size <= 4) {
593                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
594                }
595                let inner_offset;
596                let mut inner_depth = depth.clone();
597                if inlined {
598                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
599                    inner_offset = next_offset;
600                } else {
601                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
602                    inner_depth.increment()?;
603                }
604                let val_ref = self.project_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
605                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
606                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
607                {
608                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
609                }
610                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
611                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
612                }
613            }
614
615            next_offset += envelope_size;
616            _next_ordinal_to_read += 1;
617            if next_offset >= end_offset {
618                return Ok(());
619            }
620
621            // Decode unknown envelopes for gaps in ordinals.
622            while _next_ordinal_to_read < 3 {
623                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
624                _next_ordinal_to_read += 1;
625                next_offset += envelope_size;
626            }
627
628            let next_out_of_line = decoder.next_out_of_line();
629            let handles_before = decoder.remaining_handles();
630            if let Some((inlined, num_bytes, num_handles)) =
631                fidl::encoding::decode_envelope_header(decoder, next_offset)?
632            {
633                let member_inline_size =
634                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
635                if inlined != (member_inline_size <= 4) {
636                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
637                }
638                let inner_offset;
639                let mut inner_depth = depth.clone();
640                if inlined {
641                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
642                    inner_offset = next_offset;
643                } else {
644                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
645                    inner_depth.increment()?;
646                }
647                let val_ref = self.metric_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
648                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
649                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
650                {
651                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
652                }
653                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
654                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
655                }
656            }
657
658            next_offset += envelope_size;
659            _next_ordinal_to_read += 1;
660            if next_offset >= end_offset {
661                return Ok(());
662            }
663
664            // Decode unknown envelopes for gaps in ordinals.
665            while _next_ordinal_to_read < 4 {
666                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
667                _next_ordinal_to_read += 1;
668                next_offset += envelope_size;
669            }
670
671            let next_out_of_line = decoder.next_out_of_line();
672            let handles_before = decoder.remaining_handles();
673            if let Some((inlined, num_bytes, num_handles)) =
674                fidl::encoding::decode_envelope_header(decoder, next_offset)?
675            {
676                let member_inline_size =
677                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
678                if inlined != (member_inline_size <= 4) {
679                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
680                }
681                let inner_offset;
682                let mut inner_depth = depth.clone();
683                if inlined {
684                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
685                    inner_offset = next_offset;
686                } else {
687                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
688                    inner_depth.increment()?;
689                }
690                let val_ref = self.report_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
691                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
692                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
693                {
694                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
695                }
696                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
697                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
698                }
699            }
700
701            next_offset += envelope_size;
702
703            // Decode the remaining unknown envelopes.
704            while next_offset < end_offset {
705                _next_ordinal_to_read += 1;
706                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
707                next_offset += envelope_size;
708            }
709
710            Ok(())
711        }
712    }
713}