fidl_fuchsia_memory_sampler_common/
fidl_fuchsia_memory_sampler_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/// A build ID is a 20 bytes long sequence.
12pub const BUILD_ID_BYTES: u32 = 20;
13
14#[derive(Clone, Debug, PartialEq)]
15pub struct SamplerRecordAllocationRequest {
16    /// Address of the allocation, to uniquely identify it.
17    pub address: u64,
18    /// Stack frames collected at the allocation point.
19    ///
20    /// A client is free to truncate their stack traces to a size below the
21    /// maximum size of a message that can be sent over the channel. If a
22    /// client sends a StackTrace that causes to exceed the maximum size of
23    /// the message, then the record will be dropped until RFC-0196 is
24    /// implemented.
25    pub stack_trace: StackTrace,
26    /// Size (in bytes) of this allocation.
27    pub size: u64,
28}
29
30impl fidl::Persistable for SamplerRecordAllocationRequest {}
31
32#[derive(Clone, Debug, PartialEq)]
33pub struct SamplerRecordDeallocationRequest {
34    /// Address of the deallocation, to uniquely identify it.
35    pub address: u64,
36    /// Stack frames collected at the deallocation point.
37    ///
38    /// A client is free to truncate their stack traces to a size below the
39    /// maximum size of a message that can be sent over the channel. If a
40    /// client sends a StackTrace that causes to exceed the maximum size of
41    /// the message, then the record will be dropped until RFC-0196 is
42    /// implemented.
43    pub stack_trace: StackTrace,
44}
45
46impl fidl::Persistable for SamplerRecordDeallocationRequest {}
47
48/// Address region that corresponds to an executable segment in an ELF module.
49#[derive(Clone, Debug, Default, PartialEq)]
50pub struct ExecutableSegment {
51    /// Start of the region as mapped in memory.
52    pub start_address: Option<u64>,
53    /// Size of the range of addresses that are part of the region.
54    pub size: Option<u64>,
55    /// Offset of the region in the ELF binary before loading.
56    pub relative_address: Option<u64>,
57    #[doc(hidden)]
58    pub __source_breaking: fidl::marker::SourceBreaking,
59}
60
61impl fidl::Persistable for ExecutableSegment {}
62
63/// Information necessary for the symbolization of a module.
64/// Represents the subset of an ELF module relevant for the purposes of
65/// the profiler. The main use case for this map is the symbolization of stack traces.
66#[derive(Clone, Debug, Default, PartialEq)]
67pub struct ModuleMap {
68    /// Build ID, a string which uniquely identifies a module build.
69    pub build_id: Option<Vec<u8>>,
70    /// Collection of executable segments.
71    pub executable_segments: Option<Vec<ExecutableSegment>>,
72    #[doc(hidden)]
73    pub __source_breaking: fidl::marker::SourceBreaking,
74}
75
76impl fidl::Persistable for ModuleMap {}
77
78#[derive(Clone, Debug, Default, PartialEq)]
79pub struct SamplerSetProcessInfoRequest {
80    /// Name of the instrumented process.
81    pub process_name: Option<String>,
82    /// Current module layout, for symbolization.
83    pub module_map: Option<Vec<ModuleMap>>,
84    #[doc(hidden)]
85    pub __source_breaking: fidl::marker::SourceBreaking,
86}
87
88impl fidl::Persistable for SamplerSetProcessInfoRequest {}
89
90/// A stack trace, as a collection of stack frames.
91#[derive(Clone, Debug, Default, PartialEq)]
92pub struct StackTrace {
93    /// Ordered vector of frame pointers, from the narrower to the wider location.
94    pub stack_frames: Option<Vec<u64>>,
95    #[doc(hidden)]
96    pub __source_breaking: fidl::marker::SourceBreaking,
97}
98
99impl fidl::Persistable for StackTrace {}
100
101mod internal {
102    use super::*;
103
104    impl fidl::encoding::ValueTypeMarker for SamplerRecordAllocationRequest {
105        type Borrowed<'a> = &'a Self;
106        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
107            value
108        }
109    }
110
111    unsafe impl fidl::encoding::TypeMarker for SamplerRecordAllocationRequest {
112        type Owned = Self;
113
114        #[inline(always)]
115        fn inline_align(_context: fidl::encoding::Context) -> usize {
116            8
117        }
118
119        #[inline(always)]
120        fn inline_size(_context: fidl::encoding::Context) -> usize {
121            32
122        }
123    }
124
125    unsafe impl<D: fidl::encoding::ResourceDialect>
126        fidl::encoding::Encode<SamplerRecordAllocationRequest, D>
127        for &SamplerRecordAllocationRequest
128    {
129        #[inline]
130        unsafe fn encode(
131            self,
132            encoder: &mut fidl::encoding::Encoder<'_, D>,
133            offset: usize,
134            _depth: fidl::encoding::Depth,
135        ) -> fidl::Result<()> {
136            encoder.debug_check_bounds::<SamplerRecordAllocationRequest>(offset);
137            // Delegate to tuple encoding.
138            fidl::encoding::Encode::<SamplerRecordAllocationRequest, D>::encode(
139                (
140                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.address),
141                    <StackTrace as fidl::encoding::ValueTypeMarker>::borrow(&self.stack_trace),
142                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.size),
143                ),
144                encoder,
145                offset,
146                _depth,
147            )
148        }
149    }
150    unsafe impl<
151            D: fidl::encoding::ResourceDialect,
152            T0: fidl::encoding::Encode<u64, D>,
153            T1: fidl::encoding::Encode<StackTrace, D>,
154            T2: fidl::encoding::Encode<u64, D>,
155        > fidl::encoding::Encode<SamplerRecordAllocationRequest, D> for (T0, T1, T2)
156    {
157        #[inline]
158        unsafe fn encode(
159            self,
160            encoder: &mut fidl::encoding::Encoder<'_, D>,
161            offset: usize,
162            depth: fidl::encoding::Depth,
163        ) -> fidl::Result<()> {
164            encoder.debug_check_bounds::<SamplerRecordAllocationRequest>(offset);
165            // Zero out padding regions. There's no need to apply masks
166            // because the unmasked parts will be overwritten by fields.
167            // Write the fields.
168            self.0.encode(encoder, offset + 0, depth)?;
169            self.1.encode(encoder, offset + 8, depth)?;
170            self.2.encode(encoder, offset + 24, depth)?;
171            Ok(())
172        }
173    }
174
175    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
176        for SamplerRecordAllocationRequest
177    {
178        #[inline(always)]
179        fn new_empty() -> Self {
180            Self {
181                address: fidl::new_empty!(u64, D),
182                stack_trace: fidl::new_empty!(StackTrace, D),
183                size: fidl::new_empty!(u64, D),
184            }
185        }
186
187        #[inline]
188        unsafe fn decode(
189            &mut self,
190            decoder: &mut fidl::encoding::Decoder<'_, D>,
191            offset: usize,
192            _depth: fidl::encoding::Depth,
193        ) -> fidl::Result<()> {
194            decoder.debug_check_bounds::<Self>(offset);
195            // Verify that padding bytes are zero.
196            fidl::decode!(u64, D, &mut self.address, decoder, offset + 0, _depth)?;
197            fidl::decode!(StackTrace, D, &mut self.stack_trace, decoder, offset + 8, _depth)?;
198            fidl::decode!(u64, D, &mut self.size, decoder, offset + 24, _depth)?;
199            Ok(())
200        }
201    }
202
203    impl fidl::encoding::ValueTypeMarker for SamplerRecordDeallocationRequest {
204        type Borrowed<'a> = &'a Self;
205        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
206            value
207        }
208    }
209
210    unsafe impl fidl::encoding::TypeMarker for SamplerRecordDeallocationRequest {
211        type Owned = Self;
212
213        #[inline(always)]
214        fn inline_align(_context: fidl::encoding::Context) -> usize {
215            8
216        }
217
218        #[inline(always)]
219        fn inline_size(_context: fidl::encoding::Context) -> usize {
220            24
221        }
222    }
223
224    unsafe impl<D: fidl::encoding::ResourceDialect>
225        fidl::encoding::Encode<SamplerRecordDeallocationRequest, D>
226        for &SamplerRecordDeallocationRequest
227    {
228        #[inline]
229        unsafe fn encode(
230            self,
231            encoder: &mut fidl::encoding::Encoder<'_, D>,
232            offset: usize,
233            _depth: fidl::encoding::Depth,
234        ) -> fidl::Result<()> {
235            encoder.debug_check_bounds::<SamplerRecordDeallocationRequest>(offset);
236            // Delegate to tuple encoding.
237            fidl::encoding::Encode::<SamplerRecordDeallocationRequest, D>::encode(
238                (
239                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.address),
240                    <StackTrace as fidl::encoding::ValueTypeMarker>::borrow(&self.stack_trace),
241                ),
242                encoder,
243                offset,
244                _depth,
245            )
246        }
247    }
248    unsafe impl<
249            D: fidl::encoding::ResourceDialect,
250            T0: fidl::encoding::Encode<u64, D>,
251            T1: fidl::encoding::Encode<StackTrace, D>,
252        > fidl::encoding::Encode<SamplerRecordDeallocationRequest, D> for (T0, T1)
253    {
254        #[inline]
255        unsafe fn encode(
256            self,
257            encoder: &mut fidl::encoding::Encoder<'_, D>,
258            offset: usize,
259            depth: fidl::encoding::Depth,
260        ) -> fidl::Result<()> {
261            encoder.debug_check_bounds::<SamplerRecordDeallocationRequest>(offset);
262            // Zero out padding regions. There's no need to apply masks
263            // because the unmasked parts will be overwritten by fields.
264            // Write the fields.
265            self.0.encode(encoder, offset + 0, depth)?;
266            self.1.encode(encoder, offset + 8, depth)?;
267            Ok(())
268        }
269    }
270
271    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
272        for SamplerRecordDeallocationRequest
273    {
274        #[inline(always)]
275        fn new_empty() -> Self {
276            Self { address: fidl::new_empty!(u64, D), stack_trace: fidl::new_empty!(StackTrace, D) }
277        }
278
279        #[inline]
280        unsafe fn decode(
281            &mut self,
282            decoder: &mut fidl::encoding::Decoder<'_, D>,
283            offset: usize,
284            _depth: fidl::encoding::Depth,
285        ) -> fidl::Result<()> {
286            decoder.debug_check_bounds::<Self>(offset);
287            // Verify that padding bytes are zero.
288            fidl::decode!(u64, D, &mut self.address, decoder, offset + 0, _depth)?;
289            fidl::decode!(StackTrace, D, &mut self.stack_trace, decoder, offset + 8, _depth)?;
290            Ok(())
291        }
292    }
293
294    impl ExecutableSegment {
295        #[inline(always)]
296        fn max_ordinal_present(&self) -> u64 {
297            if let Some(_) = self.relative_address {
298                return 3;
299            }
300            if let Some(_) = self.size {
301                return 2;
302            }
303            if let Some(_) = self.start_address {
304                return 1;
305            }
306            0
307        }
308    }
309
310    impl fidl::encoding::ValueTypeMarker for ExecutableSegment {
311        type Borrowed<'a> = &'a Self;
312        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
313            value
314        }
315    }
316
317    unsafe impl fidl::encoding::TypeMarker for ExecutableSegment {
318        type Owned = Self;
319
320        #[inline(always)]
321        fn inline_align(_context: fidl::encoding::Context) -> usize {
322            8
323        }
324
325        #[inline(always)]
326        fn inline_size(_context: fidl::encoding::Context) -> usize {
327            16
328        }
329    }
330
331    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ExecutableSegment, D>
332        for &ExecutableSegment
333    {
334        unsafe fn encode(
335            self,
336            encoder: &mut fidl::encoding::Encoder<'_, D>,
337            offset: usize,
338            mut depth: fidl::encoding::Depth,
339        ) -> fidl::Result<()> {
340            encoder.debug_check_bounds::<ExecutableSegment>(offset);
341            // Vector header
342            let max_ordinal: u64 = self.max_ordinal_present();
343            encoder.write_num(max_ordinal, offset);
344            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
345            // Calling encoder.out_of_line_offset(0) is not allowed.
346            if max_ordinal == 0 {
347                return Ok(());
348            }
349            depth.increment()?;
350            let envelope_size = 8;
351            let bytes_len = max_ordinal as usize * envelope_size;
352            #[allow(unused_variables)]
353            let offset = encoder.out_of_line_offset(bytes_len);
354            let mut _prev_end_offset: usize = 0;
355            if 1 > max_ordinal {
356                return Ok(());
357            }
358
359            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
360            // are envelope_size bytes.
361            let cur_offset: usize = (1 - 1) * envelope_size;
362
363            // Zero reserved fields.
364            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
365
366            // Safety:
367            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
368            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
369            //   envelope_size bytes, there is always sufficient room.
370            fidl::encoding::encode_in_envelope_optional::<u64, D>(
371                self.start_address.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
372                encoder,
373                offset + cur_offset,
374                depth,
375            )?;
376
377            _prev_end_offset = cur_offset + envelope_size;
378            if 2 > max_ordinal {
379                return Ok(());
380            }
381
382            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
383            // are envelope_size bytes.
384            let cur_offset: usize = (2 - 1) * envelope_size;
385
386            // Zero reserved fields.
387            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
388
389            // Safety:
390            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
391            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
392            //   envelope_size bytes, there is always sufficient room.
393            fidl::encoding::encode_in_envelope_optional::<u64, D>(
394                self.size.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
395                encoder,
396                offset + cur_offset,
397                depth,
398            )?;
399
400            _prev_end_offset = cur_offset + envelope_size;
401            if 3 > max_ordinal {
402                return Ok(());
403            }
404
405            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
406            // are envelope_size bytes.
407            let cur_offset: usize = (3 - 1) * envelope_size;
408
409            // Zero reserved fields.
410            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
411
412            // Safety:
413            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
414            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
415            //   envelope_size bytes, there is always sufficient room.
416            fidl::encoding::encode_in_envelope_optional::<u64, D>(
417                self.relative_address
418                    .as_ref()
419                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
420                encoder,
421                offset + cur_offset,
422                depth,
423            )?;
424
425            _prev_end_offset = cur_offset + envelope_size;
426
427            Ok(())
428        }
429    }
430
431    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ExecutableSegment {
432        #[inline(always)]
433        fn new_empty() -> Self {
434            Self::default()
435        }
436
437        unsafe fn decode(
438            &mut self,
439            decoder: &mut fidl::encoding::Decoder<'_, D>,
440            offset: usize,
441            mut depth: fidl::encoding::Depth,
442        ) -> fidl::Result<()> {
443            decoder.debug_check_bounds::<Self>(offset);
444            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
445                None => return Err(fidl::Error::NotNullable),
446                Some(len) => len,
447            };
448            // Calling decoder.out_of_line_offset(0) is not allowed.
449            if len == 0 {
450                return Ok(());
451            };
452            depth.increment()?;
453            let envelope_size = 8;
454            let bytes_len = len * envelope_size;
455            let offset = decoder.out_of_line_offset(bytes_len)?;
456            // Decode the envelope for each type.
457            let mut _next_ordinal_to_read = 0;
458            let mut next_offset = offset;
459            let end_offset = offset + bytes_len;
460            _next_ordinal_to_read += 1;
461            if next_offset >= end_offset {
462                return Ok(());
463            }
464
465            // Decode unknown envelopes for gaps in ordinals.
466            while _next_ordinal_to_read < 1 {
467                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
468                _next_ordinal_to_read += 1;
469                next_offset += envelope_size;
470            }
471
472            let next_out_of_line = decoder.next_out_of_line();
473            let handles_before = decoder.remaining_handles();
474            if let Some((inlined, num_bytes, num_handles)) =
475                fidl::encoding::decode_envelope_header(decoder, next_offset)?
476            {
477                let member_inline_size =
478                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
479                if inlined != (member_inline_size <= 4) {
480                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
481                }
482                let inner_offset;
483                let mut inner_depth = depth.clone();
484                if inlined {
485                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
486                    inner_offset = next_offset;
487                } else {
488                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
489                    inner_depth.increment()?;
490                }
491                let val_ref = self.start_address.get_or_insert_with(|| fidl::new_empty!(u64, D));
492                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
493                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
494                {
495                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
496                }
497                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
498                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
499                }
500            }
501
502            next_offset += envelope_size;
503            _next_ordinal_to_read += 1;
504            if next_offset >= end_offset {
505                return Ok(());
506            }
507
508            // Decode unknown envelopes for gaps in ordinals.
509            while _next_ordinal_to_read < 2 {
510                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
511                _next_ordinal_to_read += 1;
512                next_offset += envelope_size;
513            }
514
515            let next_out_of_line = decoder.next_out_of_line();
516            let handles_before = decoder.remaining_handles();
517            if let Some((inlined, num_bytes, num_handles)) =
518                fidl::encoding::decode_envelope_header(decoder, next_offset)?
519            {
520                let member_inline_size =
521                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
522                if inlined != (member_inline_size <= 4) {
523                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
524                }
525                let inner_offset;
526                let mut inner_depth = depth.clone();
527                if inlined {
528                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
529                    inner_offset = next_offset;
530                } else {
531                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
532                    inner_depth.increment()?;
533                }
534                let val_ref = self.size.get_or_insert_with(|| fidl::new_empty!(u64, D));
535                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
536                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
537                {
538                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
539                }
540                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
541                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
542                }
543            }
544
545            next_offset += envelope_size;
546            _next_ordinal_to_read += 1;
547            if next_offset >= end_offset {
548                return Ok(());
549            }
550
551            // Decode unknown envelopes for gaps in ordinals.
552            while _next_ordinal_to_read < 3 {
553                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
554                _next_ordinal_to_read += 1;
555                next_offset += envelope_size;
556            }
557
558            let next_out_of_line = decoder.next_out_of_line();
559            let handles_before = decoder.remaining_handles();
560            if let Some((inlined, num_bytes, num_handles)) =
561                fidl::encoding::decode_envelope_header(decoder, next_offset)?
562            {
563                let member_inline_size =
564                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
565                if inlined != (member_inline_size <= 4) {
566                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
567                }
568                let inner_offset;
569                let mut inner_depth = depth.clone();
570                if inlined {
571                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
572                    inner_offset = next_offset;
573                } else {
574                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
575                    inner_depth.increment()?;
576                }
577                let val_ref = self.relative_address.get_or_insert_with(|| fidl::new_empty!(u64, D));
578                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
579                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
580                {
581                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
582                }
583                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
584                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
585                }
586            }
587
588            next_offset += envelope_size;
589
590            // Decode the remaining unknown envelopes.
591            while next_offset < end_offset {
592                _next_ordinal_to_read += 1;
593                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
594                next_offset += envelope_size;
595            }
596
597            Ok(())
598        }
599    }
600
601    impl ModuleMap {
602        #[inline(always)]
603        fn max_ordinal_present(&self) -> u64 {
604            if let Some(_) = self.executable_segments {
605                return 2;
606            }
607            if let Some(_) = self.build_id {
608                return 1;
609            }
610            0
611        }
612    }
613
614    impl fidl::encoding::ValueTypeMarker for ModuleMap {
615        type Borrowed<'a> = &'a Self;
616        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
617            value
618        }
619    }
620
621    unsafe impl fidl::encoding::TypeMarker for ModuleMap {
622        type Owned = Self;
623
624        #[inline(always)]
625        fn inline_align(_context: fidl::encoding::Context) -> usize {
626            8
627        }
628
629        #[inline(always)]
630        fn inline_size(_context: fidl::encoding::Context) -> usize {
631            16
632        }
633    }
634
635    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ModuleMap, D>
636        for &ModuleMap
637    {
638        unsafe fn encode(
639            self,
640            encoder: &mut fidl::encoding::Encoder<'_, D>,
641            offset: usize,
642            mut depth: fidl::encoding::Depth,
643        ) -> fidl::Result<()> {
644            encoder.debug_check_bounds::<ModuleMap>(offset);
645            // Vector header
646            let max_ordinal: u64 = self.max_ordinal_present();
647            encoder.write_num(max_ordinal, offset);
648            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
649            // Calling encoder.out_of_line_offset(0) is not allowed.
650            if max_ordinal == 0 {
651                return Ok(());
652            }
653            depth.increment()?;
654            let envelope_size = 8;
655            let bytes_len = max_ordinal as usize * envelope_size;
656            #[allow(unused_variables)]
657            let offset = encoder.out_of_line_offset(bytes_len);
658            let mut _prev_end_offset: usize = 0;
659            if 1 > max_ordinal {
660                return Ok(());
661            }
662
663            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
664            // are envelope_size bytes.
665            let cur_offset: usize = (1 - 1) * envelope_size;
666
667            // Zero reserved fields.
668            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
669
670            // Safety:
671            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
672            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
673            //   envelope_size bytes, there is always sufficient room.
674            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 20>, D>(
675                self.build_id.as_ref().map(
676                    <fidl::encoding::Vector<u8, 20> as fidl::encoding::ValueTypeMarker>::borrow,
677                ),
678                encoder,
679                offset + cur_offset,
680                depth,
681            )?;
682
683            _prev_end_offset = cur_offset + envelope_size;
684            if 2 > max_ordinal {
685                return Ok(());
686            }
687
688            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
689            // are envelope_size bytes.
690            let cur_offset: usize = (2 - 1) * envelope_size;
691
692            // Zero reserved fields.
693            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
694
695            // Safety:
696            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
697            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
698            //   envelope_size bytes, there is always sufficient room.
699            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<ExecutableSegment>, D>(
700            self.executable_segments.as_ref().map(<fidl::encoding::UnboundedVector<ExecutableSegment> as fidl::encoding::ValueTypeMarker>::borrow),
701            encoder, offset + cur_offset, depth
702        )?;
703
704            _prev_end_offset = cur_offset + envelope_size;
705
706            Ok(())
707        }
708    }
709
710    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ModuleMap {
711        #[inline(always)]
712        fn new_empty() -> Self {
713            Self::default()
714        }
715
716        unsafe fn decode(
717            &mut self,
718            decoder: &mut fidl::encoding::Decoder<'_, D>,
719            offset: usize,
720            mut depth: fidl::encoding::Depth,
721        ) -> fidl::Result<()> {
722            decoder.debug_check_bounds::<Self>(offset);
723            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
724                None => return Err(fidl::Error::NotNullable),
725                Some(len) => len,
726            };
727            // Calling decoder.out_of_line_offset(0) is not allowed.
728            if len == 0 {
729                return Ok(());
730            };
731            depth.increment()?;
732            let envelope_size = 8;
733            let bytes_len = len * envelope_size;
734            let offset = decoder.out_of_line_offset(bytes_len)?;
735            // Decode the envelope for each type.
736            let mut _next_ordinal_to_read = 0;
737            let mut next_offset = offset;
738            let end_offset = offset + bytes_len;
739            _next_ordinal_to_read += 1;
740            if next_offset >= end_offset {
741                return Ok(());
742            }
743
744            // Decode unknown envelopes for gaps in ordinals.
745            while _next_ordinal_to_read < 1 {
746                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
747                _next_ordinal_to_read += 1;
748                next_offset += envelope_size;
749            }
750
751            let next_out_of_line = decoder.next_out_of_line();
752            let handles_before = decoder.remaining_handles();
753            if let Some((inlined, num_bytes, num_handles)) =
754                fidl::encoding::decode_envelope_header(decoder, next_offset)?
755            {
756                let member_inline_size =
757                    <fidl::encoding::Vector<u8, 20> as fidl::encoding::TypeMarker>::inline_size(
758                        decoder.context,
759                    );
760                if inlined != (member_inline_size <= 4) {
761                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
762                }
763                let inner_offset;
764                let mut inner_depth = depth.clone();
765                if inlined {
766                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
767                    inner_offset = next_offset;
768                } else {
769                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
770                    inner_depth.increment()?;
771                }
772                let val_ref = self
773                    .build_id
774                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 20>, D));
775                fidl::decode!(fidl::encoding::Vector<u8, 20>, D, val_ref, decoder, inner_offset, inner_depth)?;
776                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
777                {
778                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
779                }
780                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
781                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
782                }
783            }
784
785            next_offset += envelope_size;
786            _next_ordinal_to_read += 1;
787            if next_offset >= end_offset {
788                return Ok(());
789            }
790
791            // Decode unknown envelopes for gaps in ordinals.
792            while _next_ordinal_to_read < 2 {
793                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
794                _next_ordinal_to_read += 1;
795                next_offset += envelope_size;
796            }
797
798            let next_out_of_line = decoder.next_out_of_line();
799            let handles_before = decoder.remaining_handles();
800            if let Some((inlined, num_bytes, num_handles)) =
801                fidl::encoding::decode_envelope_header(decoder, next_offset)?
802            {
803                let member_inline_size = <fidl::encoding::UnboundedVector<ExecutableSegment> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
804                if inlined != (member_inline_size <= 4) {
805                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
806                }
807                let inner_offset;
808                let mut inner_depth = depth.clone();
809                if inlined {
810                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
811                    inner_offset = next_offset;
812                } else {
813                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
814                    inner_depth.increment()?;
815                }
816                let val_ref = self.executable_segments.get_or_insert_with(|| {
817                    fidl::new_empty!(fidl::encoding::UnboundedVector<ExecutableSegment>, D)
818                });
819                fidl::decode!(
820                    fidl::encoding::UnboundedVector<ExecutableSegment>,
821                    D,
822                    val_ref,
823                    decoder,
824                    inner_offset,
825                    inner_depth
826                )?;
827                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
828                {
829                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
830                }
831                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
832                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
833                }
834            }
835
836            next_offset += envelope_size;
837
838            // Decode the remaining unknown envelopes.
839            while next_offset < end_offset {
840                _next_ordinal_to_read += 1;
841                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
842                next_offset += envelope_size;
843            }
844
845            Ok(())
846        }
847    }
848
849    impl SamplerSetProcessInfoRequest {
850        #[inline(always)]
851        fn max_ordinal_present(&self) -> u64 {
852            if let Some(_) = self.module_map {
853                return 2;
854            }
855            if let Some(_) = self.process_name {
856                return 1;
857            }
858            0
859        }
860    }
861
862    impl fidl::encoding::ValueTypeMarker for SamplerSetProcessInfoRequest {
863        type Borrowed<'a> = &'a Self;
864        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
865            value
866        }
867    }
868
869    unsafe impl fidl::encoding::TypeMarker for SamplerSetProcessInfoRequest {
870        type Owned = Self;
871
872        #[inline(always)]
873        fn inline_align(_context: fidl::encoding::Context) -> usize {
874            8
875        }
876
877        #[inline(always)]
878        fn inline_size(_context: fidl::encoding::Context) -> usize {
879            16
880        }
881    }
882
883    unsafe impl<D: fidl::encoding::ResourceDialect>
884        fidl::encoding::Encode<SamplerSetProcessInfoRequest, D> for &SamplerSetProcessInfoRequest
885    {
886        unsafe fn encode(
887            self,
888            encoder: &mut fidl::encoding::Encoder<'_, D>,
889            offset: usize,
890            mut depth: fidl::encoding::Depth,
891        ) -> fidl::Result<()> {
892            encoder.debug_check_bounds::<SamplerSetProcessInfoRequest>(offset);
893            // Vector header
894            let max_ordinal: u64 = self.max_ordinal_present();
895            encoder.write_num(max_ordinal, offset);
896            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
897            // Calling encoder.out_of_line_offset(0) is not allowed.
898            if max_ordinal == 0 {
899                return Ok(());
900            }
901            depth.increment()?;
902            let envelope_size = 8;
903            let bytes_len = max_ordinal as usize * envelope_size;
904            #[allow(unused_variables)]
905            let offset = encoder.out_of_line_offset(bytes_len);
906            let mut _prev_end_offset: usize = 0;
907            if 1 > max_ordinal {
908                return Ok(());
909            }
910
911            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
912            // are envelope_size bytes.
913            let cur_offset: usize = (1 - 1) * envelope_size;
914
915            // Zero reserved fields.
916            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
917
918            // Safety:
919            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
920            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
921            //   envelope_size bytes, there is always sufficient room.
922            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<32>, D>(
923                self.process_name.as_ref().map(
924                    <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow,
925                ),
926                encoder,
927                offset + cur_offset,
928                depth,
929            )?;
930
931            _prev_end_offset = cur_offset + envelope_size;
932            if 2 > max_ordinal {
933                return Ok(());
934            }
935
936            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
937            // are envelope_size bytes.
938            let cur_offset: usize = (2 - 1) * envelope_size;
939
940            // Zero reserved fields.
941            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
942
943            // Safety:
944            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
945            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
946            //   envelope_size bytes, there is always sufficient room.
947            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<ModuleMap>, D>(
948            self.module_map.as_ref().map(<fidl::encoding::UnboundedVector<ModuleMap> as fidl::encoding::ValueTypeMarker>::borrow),
949            encoder, offset + cur_offset, depth
950        )?;
951
952            _prev_end_offset = cur_offset + envelope_size;
953
954            Ok(())
955        }
956    }
957
958    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
959        for SamplerSetProcessInfoRequest
960    {
961        #[inline(always)]
962        fn new_empty() -> Self {
963            Self::default()
964        }
965
966        unsafe fn decode(
967            &mut self,
968            decoder: &mut fidl::encoding::Decoder<'_, D>,
969            offset: usize,
970            mut depth: fidl::encoding::Depth,
971        ) -> fidl::Result<()> {
972            decoder.debug_check_bounds::<Self>(offset);
973            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
974                None => return Err(fidl::Error::NotNullable),
975                Some(len) => len,
976            };
977            // Calling decoder.out_of_line_offset(0) is not allowed.
978            if len == 0 {
979                return Ok(());
980            };
981            depth.increment()?;
982            let envelope_size = 8;
983            let bytes_len = len * envelope_size;
984            let offset = decoder.out_of_line_offset(bytes_len)?;
985            // Decode the envelope for each type.
986            let mut _next_ordinal_to_read = 0;
987            let mut next_offset = offset;
988            let end_offset = offset + bytes_len;
989            _next_ordinal_to_read += 1;
990            if next_offset >= end_offset {
991                return Ok(());
992            }
993
994            // Decode unknown envelopes for gaps in ordinals.
995            while _next_ordinal_to_read < 1 {
996                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
997                _next_ordinal_to_read += 1;
998                next_offset += envelope_size;
999            }
1000
1001            let next_out_of_line = decoder.next_out_of_line();
1002            let handles_before = decoder.remaining_handles();
1003            if let Some((inlined, num_bytes, num_handles)) =
1004                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1005            {
1006                let member_inline_size =
1007                    <fidl::encoding::BoundedString<32> as fidl::encoding::TypeMarker>::inline_size(
1008                        decoder.context,
1009                    );
1010                if inlined != (member_inline_size <= 4) {
1011                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1012                }
1013                let inner_offset;
1014                let mut inner_depth = depth.clone();
1015                if inlined {
1016                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1017                    inner_offset = next_offset;
1018                } else {
1019                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1020                    inner_depth.increment()?;
1021                }
1022                let val_ref = self
1023                    .process_name
1024                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<32>, D));
1025                fidl::decode!(
1026                    fidl::encoding::BoundedString<32>,
1027                    D,
1028                    val_ref,
1029                    decoder,
1030                    inner_offset,
1031                    inner_depth
1032                )?;
1033                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1034                {
1035                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1036                }
1037                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1038                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1039                }
1040            }
1041
1042            next_offset += envelope_size;
1043            _next_ordinal_to_read += 1;
1044            if next_offset >= end_offset {
1045                return Ok(());
1046            }
1047
1048            // Decode unknown envelopes for gaps in ordinals.
1049            while _next_ordinal_to_read < 2 {
1050                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1051                _next_ordinal_to_read += 1;
1052                next_offset += envelope_size;
1053            }
1054
1055            let next_out_of_line = decoder.next_out_of_line();
1056            let handles_before = decoder.remaining_handles();
1057            if let Some((inlined, num_bytes, num_handles)) =
1058                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1059            {
1060                let member_inline_size = <fidl::encoding::UnboundedVector<ModuleMap> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1061                if inlined != (member_inline_size <= 4) {
1062                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1063                }
1064                let inner_offset;
1065                let mut inner_depth = depth.clone();
1066                if inlined {
1067                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1068                    inner_offset = next_offset;
1069                } else {
1070                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1071                    inner_depth.increment()?;
1072                }
1073                let val_ref = self.module_map.get_or_insert_with(|| {
1074                    fidl::new_empty!(fidl::encoding::UnboundedVector<ModuleMap>, D)
1075                });
1076                fidl::decode!(
1077                    fidl::encoding::UnboundedVector<ModuleMap>,
1078                    D,
1079                    val_ref,
1080                    decoder,
1081                    inner_offset,
1082                    inner_depth
1083                )?;
1084                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1085                {
1086                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1087                }
1088                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1089                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1090                }
1091            }
1092
1093            next_offset += envelope_size;
1094
1095            // Decode the remaining unknown envelopes.
1096            while next_offset < end_offset {
1097                _next_ordinal_to_read += 1;
1098                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1099                next_offset += envelope_size;
1100            }
1101
1102            Ok(())
1103        }
1104    }
1105
1106    impl StackTrace {
1107        #[inline(always)]
1108        fn max_ordinal_present(&self) -> u64 {
1109            if let Some(_) = self.stack_frames {
1110                return 1;
1111            }
1112            0
1113        }
1114    }
1115
1116    impl fidl::encoding::ValueTypeMarker for StackTrace {
1117        type Borrowed<'a> = &'a Self;
1118        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1119            value
1120        }
1121    }
1122
1123    unsafe impl fidl::encoding::TypeMarker for StackTrace {
1124        type Owned = Self;
1125
1126        #[inline(always)]
1127        fn inline_align(_context: fidl::encoding::Context) -> usize {
1128            8
1129        }
1130
1131        #[inline(always)]
1132        fn inline_size(_context: fidl::encoding::Context) -> usize {
1133            16
1134        }
1135    }
1136
1137    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StackTrace, D>
1138        for &StackTrace
1139    {
1140        unsafe fn encode(
1141            self,
1142            encoder: &mut fidl::encoding::Encoder<'_, D>,
1143            offset: usize,
1144            mut depth: fidl::encoding::Depth,
1145        ) -> fidl::Result<()> {
1146            encoder.debug_check_bounds::<StackTrace>(offset);
1147            // Vector header
1148            let max_ordinal: u64 = self.max_ordinal_present();
1149            encoder.write_num(max_ordinal, offset);
1150            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1151            // Calling encoder.out_of_line_offset(0) is not allowed.
1152            if max_ordinal == 0 {
1153                return Ok(());
1154            }
1155            depth.increment()?;
1156            let envelope_size = 8;
1157            let bytes_len = max_ordinal as usize * envelope_size;
1158            #[allow(unused_variables)]
1159            let offset = encoder.out_of_line_offset(bytes_len);
1160            let mut _prev_end_offset: usize = 0;
1161            if 1 > max_ordinal {
1162                return Ok(());
1163            }
1164
1165            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1166            // are envelope_size bytes.
1167            let cur_offset: usize = (1 - 1) * envelope_size;
1168
1169            // Zero reserved fields.
1170            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1171
1172            // Safety:
1173            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1174            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1175            //   envelope_size bytes, there is always sufficient room.
1176            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<u64>, D>(
1177            self.stack_frames.as_ref().map(<fidl::encoding::UnboundedVector<u64> as fidl::encoding::ValueTypeMarker>::borrow),
1178            encoder, offset + cur_offset, depth
1179        )?;
1180
1181            _prev_end_offset = cur_offset + envelope_size;
1182
1183            Ok(())
1184        }
1185    }
1186
1187    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StackTrace {
1188        #[inline(always)]
1189        fn new_empty() -> Self {
1190            Self::default()
1191        }
1192
1193        unsafe fn decode(
1194            &mut self,
1195            decoder: &mut fidl::encoding::Decoder<'_, D>,
1196            offset: usize,
1197            mut depth: fidl::encoding::Depth,
1198        ) -> fidl::Result<()> {
1199            decoder.debug_check_bounds::<Self>(offset);
1200            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1201                None => return Err(fidl::Error::NotNullable),
1202                Some(len) => len,
1203            };
1204            // Calling decoder.out_of_line_offset(0) is not allowed.
1205            if len == 0 {
1206                return Ok(());
1207            };
1208            depth.increment()?;
1209            let envelope_size = 8;
1210            let bytes_len = len * envelope_size;
1211            let offset = decoder.out_of_line_offset(bytes_len)?;
1212            // Decode the envelope for each type.
1213            let mut _next_ordinal_to_read = 0;
1214            let mut next_offset = offset;
1215            let end_offset = offset + bytes_len;
1216            _next_ordinal_to_read += 1;
1217            if next_offset >= end_offset {
1218                return Ok(());
1219            }
1220
1221            // Decode unknown envelopes for gaps in ordinals.
1222            while _next_ordinal_to_read < 1 {
1223                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1224                _next_ordinal_to_read += 1;
1225                next_offset += envelope_size;
1226            }
1227
1228            let next_out_of_line = decoder.next_out_of_line();
1229            let handles_before = decoder.remaining_handles();
1230            if let Some((inlined, num_bytes, num_handles)) =
1231                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1232            {
1233                let member_inline_size = <fidl::encoding::UnboundedVector<u64> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1234                if inlined != (member_inline_size <= 4) {
1235                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1236                }
1237                let inner_offset;
1238                let mut inner_depth = depth.clone();
1239                if inlined {
1240                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1241                    inner_offset = next_offset;
1242                } else {
1243                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1244                    inner_depth.increment()?;
1245                }
1246                let val_ref = self.stack_frames.get_or_insert_with(|| {
1247                    fidl::new_empty!(fidl::encoding::UnboundedVector<u64>, D)
1248                });
1249                fidl::decode!(
1250                    fidl::encoding::UnboundedVector<u64>,
1251                    D,
1252                    val_ref,
1253                    decoder,
1254                    inner_offset,
1255                    inner_depth
1256                )?;
1257                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1258                {
1259                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1260                }
1261                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1262                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1263                }
1264            }
1265
1266            next_offset += envelope_size;
1267
1268            // Decode the remaining unknown envelopes.
1269            while next_offset < end_offset {
1270                _next_ordinal_to_read += 1;
1271                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1272                next_offset += envelope_size;
1273            }
1274
1275            Ok(())
1276        }
1277    }
1278}