Skip to main content

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