Skip to main content

fidl_fuchsia_hardware_hrtimer_common/
fidl_fuchsia_hardware_hrtimer_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/// Maximum count of resolutions supported by a given timer, arbitrary.
12pub const MAX_COUNT_RESOLUTIONS: u32 = 64;
13
14/// Maximum count of timers supported by this protocol, arbitrary.
15pub const MAX_COUNT_TIMERS: u32 = 64;
16
17/// Errors that this driver may return.
18#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
19pub enum DriverError {
20    /// The driver encountered an otherwise unspecified error while performing the operation.
21    InternalError,
22    /// The operation is not implemented, supported, or enabled.
23    NotSupported,
24    /// An argument is invalid.
25    InvalidArgs,
26    /// The operation failed because the current state of the driver does not allow it, or a
27    /// precondition of the operation is not satisfied.
28    BadState,
29    /// The in-progress operation has been canceled.
30    Canceled,
31    #[doc(hidden)]
32    __SourceBreaking { unknown_ordinal: u32 },
33}
34
35/// Pattern that matches an unknown `DriverError` member.
36#[macro_export]
37macro_rules! DriverErrorUnknown {
38    () => {
39        _
40    };
41}
42
43impl DriverError {
44    #[inline]
45    pub fn from_primitive(prim: u32) -> Option<Self> {
46        match prim {
47            1 => Some(Self::InternalError),
48            2 => Some(Self::NotSupported),
49            3 => Some(Self::InvalidArgs),
50            4 => Some(Self::BadState),
51            5 => Some(Self::Canceled),
52            _ => None,
53        }
54    }
55
56    #[inline]
57    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
58        match prim {
59            1 => Self::InternalError,
60            2 => Self::NotSupported,
61            3 => Self::InvalidArgs,
62            4 => Self::BadState,
63            5 => Self::Canceled,
64            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
65        }
66    }
67
68    #[inline]
69    pub fn unknown() -> Self {
70        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
71    }
72
73    #[inline]
74    pub const fn into_primitive(self) -> u32 {
75        match self {
76            Self::InternalError => 1,
77            Self::NotSupported => 2,
78            Self::InvalidArgs => 3,
79            Self::BadState => 4,
80            Self::Canceled => 5,
81            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
82        }
83    }
84
85    #[inline]
86    pub fn is_unknown(&self) -> bool {
87        match self {
88            Self::__SourceBreaking { unknown_ordinal: _ } => true,
89            _ => false,
90        }
91    }
92}
93
94/// Indicates the power-up state of the timer hardware at boot.
95#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
96pub enum PowerUpState {
97    /// The power-up state is unknown or not reported by the hardware.
98    Unknown,
99    /// The hardware powered up normally (backup power was maintained).
100    Regular,
101    /// The hardware powered up after a battery drain or full power loss
102    /// (backup domain registers were reset).
103    BatteryDrain,
104    #[doc(hidden)]
105    __SourceBreaking { unknown_ordinal: u32 },
106}
107
108/// Pattern that matches an unknown `PowerUpState` member.
109#[macro_export]
110macro_rules! PowerUpStateUnknown {
111    () => {
112        _
113    };
114}
115
116impl PowerUpState {
117    #[inline]
118    pub fn from_primitive(prim: u32) -> Option<Self> {
119        match prim {
120            0 => Some(Self::Unknown),
121            1 => Some(Self::Regular),
122            2 => Some(Self::BatteryDrain),
123            _ => None,
124        }
125    }
126
127    #[inline]
128    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
129        match prim {
130            0 => Self::Unknown,
131            1 => Self::Regular,
132            2 => Self::BatteryDrain,
133            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
134        }
135    }
136
137    #[inline]
138    pub fn unknown() -> Self {
139        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
140    }
141
142    #[inline]
143    pub const fn into_primitive(self) -> u32 {
144        match self {
145            Self::Unknown => 0,
146            Self::Regular => 1,
147            Self::BatteryDrain => 2,
148            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
149        }
150    }
151
152    #[inline]
153    pub fn is_unknown(&self) -> bool {
154        match self {
155            Self::__SourceBreaking { unknown_ordinal: _ } => true,
156            _ => false,
157        }
158    }
159}
160
161#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
162#[repr(C)]
163pub struct DeviceGetTicksLeftRequest {
164    pub id: u64,
165}
166
167impl fidl::Persistable for DeviceGetTicksLeftRequest {}
168
169#[derive(Clone, Debug, PartialEq)]
170pub struct DeviceReadClockRequest {
171    pub id: u64,
172    pub resolution: Resolution,
173}
174
175impl fidl::Persistable for DeviceReadClockRequest {}
176
177#[derive(Clone, Debug, PartialEq)]
178pub struct DeviceReadTimerRequest {
179    pub id: u64,
180    pub resolution: Resolution,
181}
182
183impl fidl::Persistable for DeviceReadTimerRequest {}
184
185#[derive(Clone, Debug, PartialEq)]
186pub struct DeviceStartRequest {
187    pub id: u64,
188    pub resolution: Resolution,
189    pub ticks: u64,
190}
191
192impl fidl::Persistable for DeviceStartRequest {}
193
194#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
195#[repr(C)]
196pub struct DeviceStopRequest {
197    pub id: u64,
198}
199
200impl fidl::Persistable for DeviceStopRequest {}
201
202#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
203#[repr(C)]
204pub struct DeviceGetTicksLeftResponse {
205    pub ticks: u64,
206}
207
208impl fidl::Persistable for DeviceGetTicksLeftResponse {}
209
210#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
211#[repr(C)]
212pub struct DeviceReadClockResponse {
213    pub ticks: u64,
214}
215
216impl fidl::Persistable for DeviceReadClockResponse {}
217
218#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
219#[repr(C)]
220pub struct DeviceReadTimerResponse {
221    pub ticks: u64,
222}
223
224impl fidl::Persistable for DeviceReadTimerResponse {}
225
226/// Properties for a specific timer abstracted by the driver.
227#[derive(Clone, Debug, Default, PartialEq)]
228pub struct TimerProperties {
229    /// Unique identifier for this timer.
230    ///
231    /// The `id` is stable for a given timer, i.e. it does not change across different clients
232    /// or different connections from the same client.
233    ///
234    /// Required.
235    pub id: Option<u64>,
236    /// Retrieves the resolutions supported by this timer.
237    ///
238    /// Required.
239    pub supported_resolutions: Option<Vec<Resolution>>,
240    /// Range in ticks.
241    ///
242    /// This is the maximum amount of time that can be set in terms of ticks when a timer is
243    /// started. The maximum range in actual time (e.g. nanoseconds) depends on the resolution used.
244    ///
245    /// NOTE: The value reported here does not need to be identical to what
246    /// the hardware actually supports. The driver MAY provide the support for
247    /// the reported `max_ticks` that is greater than the largest value of ticks
248    /// that can be put into the device's hardware register. The driver supports
249    /// a greater value of `max_ticks` by re-programming the hardware counter multiple times
250    /// with its maximum supported interval, with an interrupt generated after
251    /// each re-programming. If you want as few re-programmings (and interrupts)
252    /// to happen as possible, as may be the case when using the hrtimer in a power-aware
253    /// context, select the coarsest available resolution from [supported_resolutions].
254    /// This will ensure the longest possible wall-clock time passes without a re-program.
255    ///
256    /// Required.
257    pub max_ticks: Option<u64>,
258    /// If true then the `SetEvent` method is supported, if false or not present it is not
259    /// supported.
260    ///
261    /// Optional.
262    pub supports_event: Option<bool>,
263    /// If true then the `StartAndWait` and `StartAndWait2` methods are supported, if false or
264    /// not present these methods are not supported.
265    ///
266    /// Optional.
267    pub supports_wait: Option<bool>,
268    /// If true, then the `TimerRead` and `ClockRead` methods are supported, if
269    /// false or not present, these methods are not supported.
270    ///
271    /// Optional.
272    pub supports_read: Option<bool>,
273    /// Indicates the power-up state of the timer hardware at boot.
274    ///
275    /// If not present, the power-up state is `PowerUpState.UNKNOWN`.
276    ///
277    /// Optional.
278    pub power_up_state: Option<PowerUpState>,
279    #[doc(hidden)]
280    pub __source_breaking: fidl::marker::SourceBreaking,
281}
282
283impl fidl::Persistable for TimerProperties {}
284
285/// Amount of time for one tick of a timer.
286#[derive(Clone, Debug)]
287pub enum Resolution {
288    /// The resolution specified for one tick.
289    Duration(i64),
290    #[doc(hidden)]
291    __SourceBreaking { unknown_ordinal: u64 },
292}
293
294/// Pattern that matches an unknown `Resolution` member.
295#[macro_export]
296macro_rules! ResolutionUnknown {
297    () => {
298        _
299    };
300}
301
302// Custom PartialEq so that unknown variants are not equal to themselves.
303impl PartialEq for Resolution {
304    fn eq(&self, other: &Self) -> bool {
305        match (self, other) {
306            (Self::Duration(x), Self::Duration(y)) => *x == *y,
307            _ => false,
308        }
309    }
310}
311
312impl Resolution {
313    #[inline]
314    pub fn ordinal(&self) -> u64 {
315        match *self {
316            Self::Duration(_) => 1,
317            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
318        }
319    }
320
321    #[inline]
322    pub fn unknown_variant_for_testing() -> Self {
323        Self::__SourceBreaking { unknown_ordinal: 0 }
324    }
325
326    #[inline]
327    pub fn is_unknown(&self) -> bool {
328        match self {
329            Self::__SourceBreaking { .. } => true,
330            _ => false,
331        }
332    }
333}
334
335impl fidl::Persistable for Resolution {}
336
337pub mod device_ordinals {
338    pub const START: u64 = 0x5a0a193b0467cc8a;
339    pub const READ_TIMER: u64 = 0x4430d0e336ffb5e9;
340    pub const READ_CLOCK: u64 = 0x49aae10e0fb621ab;
341    pub const STOP: u64 = 0x77e4cd1c3841a0e2;
342    pub const GET_TICKS_LEFT: u64 = 0xde2a48ae7d4b4ea;
343    pub const SET_EVENT: u64 = 0x1027024d25ffa820;
344    pub const START_AND_WAIT: u64 = 0x716f415cdf234e0f;
345    pub const START_AND_WAIT2: u64 = 0x5f2aaf21254d3238;
346    pub const GET_PROPERTIES: u64 = 0x6bc22ab4c9396cbb;
347}
348
349mod internal {
350    use super::*;
351    unsafe impl fidl::encoding::TypeMarker for DriverError {
352        type Owned = Self;
353
354        #[inline(always)]
355        fn inline_align(_context: fidl::encoding::Context) -> usize {
356            std::mem::align_of::<u32>()
357        }
358
359        #[inline(always)]
360        fn inline_size(_context: fidl::encoding::Context) -> usize {
361            std::mem::size_of::<u32>()
362        }
363
364        #[inline(always)]
365        fn encode_is_copy() -> bool {
366            false
367        }
368
369        #[inline(always)]
370        fn decode_is_copy() -> bool {
371            false
372        }
373    }
374
375    impl fidl::encoding::ValueTypeMarker for DriverError {
376        type Borrowed<'a> = Self;
377        #[inline(always)]
378        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
379            *value
380        }
381    }
382
383    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for DriverError {
384        #[inline]
385        unsafe fn encode(
386            self,
387            encoder: &mut fidl::encoding::Encoder<'_, D>,
388            offset: usize,
389            _depth: fidl::encoding::Depth,
390        ) -> fidl::Result<()> {
391            encoder.debug_check_bounds::<Self>(offset);
392            encoder.write_num(self.into_primitive(), offset);
393            Ok(())
394        }
395    }
396
397    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DriverError {
398        #[inline(always)]
399        fn new_empty() -> Self {
400            Self::unknown()
401        }
402
403        #[inline]
404        unsafe fn decode(
405            &mut self,
406            decoder: &mut fidl::encoding::Decoder<'_, D>,
407            offset: usize,
408            _depth: fidl::encoding::Depth,
409        ) -> fidl::Result<()> {
410            decoder.debug_check_bounds::<Self>(offset);
411            let prim = decoder.read_num::<u32>(offset);
412
413            *self = Self::from_primitive_allow_unknown(prim);
414            Ok(())
415        }
416    }
417    unsafe impl fidl::encoding::TypeMarker for PowerUpState {
418        type Owned = Self;
419
420        #[inline(always)]
421        fn inline_align(_context: fidl::encoding::Context) -> usize {
422            std::mem::align_of::<u32>()
423        }
424
425        #[inline(always)]
426        fn inline_size(_context: fidl::encoding::Context) -> usize {
427            std::mem::size_of::<u32>()
428        }
429
430        #[inline(always)]
431        fn encode_is_copy() -> bool {
432            false
433        }
434
435        #[inline(always)]
436        fn decode_is_copy() -> bool {
437            false
438        }
439    }
440
441    impl fidl::encoding::ValueTypeMarker for PowerUpState {
442        type Borrowed<'a> = Self;
443        #[inline(always)]
444        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
445            *value
446        }
447    }
448
449    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for PowerUpState {
450        #[inline]
451        unsafe fn encode(
452            self,
453            encoder: &mut fidl::encoding::Encoder<'_, D>,
454            offset: usize,
455            _depth: fidl::encoding::Depth,
456        ) -> fidl::Result<()> {
457            encoder.debug_check_bounds::<Self>(offset);
458            encoder.write_num(self.into_primitive(), offset);
459            Ok(())
460        }
461    }
462
463    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PowerUpState {
464        #[inline(always)]
465        fn new_empty() -> Self {
466            Self::unknown()
467        }
468
469        #[inline]
470        unsafe fn decode(
471            &mut self,
472            decoder: &mut fidl::encoding::Decoder<'_, D>,
473            offset: usize,
474            _depth: fidl::encoding::Depth,
475        ) -> fidl::Result<()> {
476            decoder.debug_check_bounds::<Self>(offset);
477            let prim = decoder.read_num::<u32>(offset);
478
479            *self = Self::from_primitive_allow_unknown(prim);
480            Ok(())
481        }
482    }
483
484    impl fidl::encoding::ValueTypeMarker for DeviceGetTicksLeftRequest {
485        type Borrowed<'a> = &'a Self;
486        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
487            value
488        }
489    }
490
491    unsafe impl fidl::encoding::TypeMarker for DeviceGetTicksLeftRequest {
492        type Owned = Self;
493
494        #[inline(always)]
495        fn inline_align(_context: fidl::encoding::Context) -> usize {
496            8
497        }
498
499        #[inline(always)]
500        fn inline_size(_context: fidl::encoding::Context) -> usize {
501            8
502        }
503        #[inline(always)]
504        fn encode_is_copy() -> bool {
505            true
506        }
507
508        #[inline(always)]
509        fn decode_is_copy() -> bool {
510            true
511        }
512    }
513
514    unsafe impl<D: fidl::encoding::ResourceDialect>
515        fidl::encoding::Encode<DeviceGetTicksLeftRequest, D> for &DeviceGetTicksLeftRequest
516    {
517        #[inline]
518        unsafe fn encode(
519            self,
520            encoder: &mut fidl::encoding::Encoder<'_, D>,
521            offset: usize,
522            _depth: fidl::encoding::Depth,
523        ) -> fidl::Result<()> {
524            encoder.debug_check_bounds::<DeviceGetTicksLeftRequest>(offset);
525            unsafe {
526                // Copy the object into the buffer.
527                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
528                (buf_ptr as *mut DeviceGetTicksLeftRequest)
529                    .write_unaligned((self as *const DeviceGetTicksLeftRequest).read());
530                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
531                // done second because the memcpy will write garbage to these bytes.
532            }
533            Ok(())
534        }
535    }
536    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
537        fidl::encoding::Encode<DeviceGetTicksLeftRequest, D> for (T0,)
538    {
539        #[inline]
540        unsafe fn encode(
541            self,
542            encoder: &mut fidl::encoding::Encoder<'_, D>,
543            offset: usize,
544            depth: fidl::encoding::Depth,
545        ) -> fidl::Result<()> {
546            encoder.debug_check_bounds::<DeviceGetTicksLeftRequest>(offset);
547            // Zero out padding regions. There's no need to apply masks
548            // because the unmasked parts will be overwritten by fields.
549            // Write the fields.
550            self.0.encode(encoder, offset + 0, depth)?;
551            Ok(())
552        }
553    }
554
555    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
556        for DeviceGetTicksLeftRequest
557    {
558        #[inline(always)]
559        fn new_empty() -> Self {
560            Self { id: fidl::new_empty!(u64, D) }
561        }
562
563        #[inline]
564        unsafe fn decode(
565            &mut self,
566            decoder: &mut fidl::encoding::Decoder<'_, D>,
567            offset: usize,
568            _depth: fidl::encoding::Depth,
569        ) -> fidl::Result<()> {
570            decoder.debug_check_bounds::<Self>(offset);
571            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
572            // Verify that padding bytes are zero.
573            // Copy from the buffer into the object.
574            unsafe {
575                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
576            }
577            Ok(())
578        }
579    }
580
581    impl fidl::encoding::ValueTypeMarker for DeviceReadClockRequest {
582        type Borrowed<'a> = &'a Self;
583        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
584            value
585        }
586    }
587
588    unsafe impl fidl::encoding::TypeMarker for DeviceReadClockRequest {
589        type Owned = Self;
590
591        #[inline(always)]
592        fn inline_align(_context: fidl::encoding::Context) -> usize {
593            8
594        }
595
596        #[inline(always)]
597        fn inline_size(_context: fidl::encoding::Context) -> usize {
598            24
599        }
600    }
601
602    unsafe impl<D: fidl::encoding::ResourceDialect>
603        fidl::encoding::Encode<DeviceReadClockRequest, D> for &DeviceReadClockRequest
604    {
605        #[inline]
606        unsafe fn encode(
607            self,
608            encoder: &mut fidl::encoding::Encoder<'_, D>,
609            offset: usize,
610            _depth: fidl::encoding::Depth,
611        ) -> fidl::Result<()> {
612            encoder.debug_check_bounds::<DeviceReadClockRequest>(offset);
613            // Delegate to tuple encoding.
614            fidl::encoding::Encode::<DeviceReadClockRequest, D>::encode(
615                (
616                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
617                    <Resolution as fidl::encoding::ValueTypeMarker>::borrow(&self.resolution),
618                ),
619                encoder,
620                offset,
621                _depth,
622            )
623        }
624    }
625    unsafe impl<
626        D: fidl::encoding::ResourceDialect,
627        T0: fidl::encoding::Encode<u64, D>,
628        T1: fidl::encoding::Encode<Resolution, D>,
629    > fidl::encoding::Encode<DeviceReadClockRequest, D> for (T0, T1)
630    {
631        #[inline]
632        unsafe fn encode(
633            self,
634            encoder: &mut fidl::encoding::Encoder<'_, D>,
635            offset: usize,
636            depth: fidl::encoding::Depth,
637        ) -> fidl::Result<()> {
638            encoder.debug_check_bounds::<DeviceReadClockRequest>(offset);
639            // Zero out padding regions. There's no need to apply masks
640            // because the unmasked parts will be overwritten by fields.
641            // Write the fields.
642            self.0.encode(encoder, offset + 0, depth)?;
643            self.1.encode(encoder, offset + 8, depth)?;
644            Ok(())
645        }
646    }
647
648    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
649        for DeviceReadClockRequest
650    {
651        #[inline(always)]
652        fn new_empty() -> Self {
653            Self { id: fidl::new_empty!(u64, D), resolution: fidl::new_empty!(Resolution, D) }
654        }
655
656        #[inline]
657        unsafe fn decode(
658            &mut self,
659            decoder: &mut fidl::encoding::Decoder<'_, D>,
660            offset: usize,
661            _depth: fidl::encoding::Depth,
662        ) -> fidl::Result<()> {
663            decoder.debug_check_bounds::<Self>(offset);
664            // Verify that padding bytes are zero.
665            fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
666            fidl::decode!(Resolution, D, &mut self.resolution, decoder, offset + 8, _depth)?;
667            Ok(())
668        }
669    }
670
671    impl fidl::encoding::ValueTypeMarker for DeviceReadTimerRequest {
672        type Borrowed<'a> = &'a Self;
673        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
674            value
675        }
676    }
677
678    unsafe impl fidl::encoding::TypeMarker for DeviceReadTimerRequest {
679        type Owned = Self;
680
681        #[inline(always)]
682        fn inline_align(_context: fidl::encoding::Context) -> usize {
683            8
684        }
685
686        #[inline(always)]
687        fn inline_size(_context: fidl::encoding::Context) -> usize {
688            24
689        }
690    }
691
692    unsafe impl<D: fidl::encoding::ResourceDialect>
693        fidl::encoding::Encode<DeviceReadTimerRequest, D> for &DeviceReadTimerRequest
694    {
695        #[inline]
696        unsafe fn encode(
697            self,
698            encoder: &mut fidl::encoding::Encoder<'_, D>,
699            offset: usize,
700            _depth: fidl::encoding::Depth,
701        ) -> fidl::Result<()> {
702            encoder.debug_check_bounds::<DeviceReadTimerRequest>(offset);
703            // Delegate to tuple encoding.
704            fidl::encoding::Encode::<DeviceReadTimerRequest, D>::encode(
705                (
706                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
707                    <Resolution as fidl::encoding::ValueTypeMarker>::borrow(&self.resolution),
708                ),
709                encoder,
710                offset,
711                _depth,
712            )
713        }
714    }
715    unsafe impl<
716        D: fidl::encoding::ResourceDialect,
717        T0: fidl::encoding::Encode<u64, D>,
718        T1: fidl::encoding::Encode<Resolution, D>,
719    > fidl::encoding::Encode<DeviceReadTimerRequest, D> for (T0, T1)
720    {
721        #[inline]
722        unsafe fn encode(
723            self,
724            encoder: &mut fidl::encoding::Encoder<'_, D>,
725            offset: usize,
726            depth: fidl::encoding::Depth,
727        ) -> fidl::Result<()> {
728            encoder.debug_check_bounds::<DeviceReadTimerRequest>(offset);
729            // Zero out padding regions. There's no need to apply masks
730            // because the unmasked parts will be overwritten by fields.
731            // Write the fields.
732            self.0.encode(encoder, offset + 0, depth)?;
733            self.1.encode(encoder, offset + 8, depth)?;
734            Ok(())
735        }
736    }
737
738    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
739        for DeviceReadTimerRequest
740    {
741        #[inline(always)]
742        fn new_empty() -> Self {
743            Self { id: fidl::new_empty!(u64, D), resolution: fidl::new_empty!(Resolution, D) }
744        }
745
746        #[inline]
747        unsafe fn decode(
748            &mut self,
749            decoder: &mut fidl::encoding::Decoder<'_, D>,
750            offset: usize,
751            _depth: fidl::encoding::Depth,
752        ) -> fidl::Result<()> {
753            decoder.debug_check_bounds::<Self>(offset);
754            // Verify that padding bytes are zero.
755            fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
756            fidl::decode!(Resolution, D, &mut self.resolution, decoder, offset + 8, _depth)?;
757            Ok(())
758        }
759    }
760
761    impl fidl::encoding::ValueTypeMarker for DeviceStartRequest {
762        type Borrowed<'a> = &'a Self;
763        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
764            value
765        }
766    }
767
768    unsafe impl fidl::encoding::TypeMarker for DeviceStartRequest {
769        type Owned = Self;
770
771        #[inline(always)]
772        fn inline_align(_context: fidl::encoding::Context) -> usize {
773            8
774        }
775
776        #[inline(always)]
777        fn inline_size(_context: fidl::encoding::Context) -> usize {
778            32
779        }
780    }
781
782    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceStartRequest, D>
783        for &DeviceStartRequest
784    {
785        #[inline]
786        unsafe fn encode(
787            self,
788            encoder: &mut fidl::encoding::Encoder<'_, D>,
789            offset: usize,
790            _depth: fidl::encoding::Depth,
791        ) -> fidl::Result<()> {
792            encoder.debug_check_bounds::<DeviceStartRequest>(offset);
793            // Delegate to tuple encoding.
794            fidl::encoding::Encode::<DeviceStartRequest, D>::encode(
795                (
796                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
797                    <Resolution as fidl::encoding::ValueTypeMarker>::borrow(&self.resolution),
798                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.ticks),
799                ),
800                encoder,
801                offset,
802                _depth,
803            )
804        }
805    }
806    unsafe impl<
807        D: fidl::encoding::ResourceDialect,
808        T0: fidl::encoding::Encode<u64, D>,
809        T1: fidl::encoding::Encode<Resolution, D>,
810        T2: fidl::encoding::Encode<u64, D>,
811    > fidl::encoding::Encode<DeviceStartRequest, D> for (T0, T1, T2)
812    {
813        #[inline]
814        unsafe fn encode(
815            self,
816            encoder: &mut fidl::encoding::Encoder<'_, D>,
817            offset: usize,
818            depth: fidl::encoding::Depth,
819        ) -> fidl::Result<()> {
820            encoder.debug_check_bounds::<DeviceStartRequest>(offset);
821            // Zero out padding regions. There's no need to apply masks
822            // because the unmasked parts will be overwritten by fields.
823            // Write the fields.
824            self.0.encode(encoder, offset + 0, depth)?;
825            self.1.encode(encoder, offset + 8, depth)?;
826            self.2.encode(encoder, offset + 24, depth)?;
827            Ok(())
828        }
829    }
830
831    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceStartRequest {
832        #[inline(always)]
833        fn new_empty() -> Self {
834            Self {
835                id: fidl::new_empty!(u64, D),
836                resolution: fidl::new_empty!(Resolution, D),
837                ticks: fidl::new_empty!(u64, D),
838            }
839        }
840
841        #[inline]
842        unsafe fn decode(
843            &mut self,
844            decoder: &mut fidl::encoding::Decoder<'_, D>,
845            offset: usize,
846            _depth: fidl::encoding::Depth,
847        ) -> fidl::Result<()> {
848            decoder.debug_check_bounds::<Self>(offset);
849            // Verify that padding bytes are zero.
850            fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
851            fidl::decode!(Resolution, D, &mut self.resolution, decoder, offset + 8, _depth)?;
852            fidl::decode!(u64, D, &mut self.ticks, decoder, offset + 24, _depth)?;
853            Ok(())
854        }
855    }
856
857    impl fidl::encoding::ValueTypeMarker for DeviceStopRequest {
858        type Borrowed<'a> = &'a Self;
859        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
860            value
861        }
862    }
863
864    unsafe impl fidl::encoding::TypeMarker for DeviceStopRequest {
865        type Owned = Self;
866
867        #[inline(always)]
868        fn inline_align(_context: fidl::encoding::Context) -> usize {
869            8
870        }
871
872        #[inline(always)]
873        fn inline_size(_context: fidl::encoding::Context) -> usize {
874            8
875        }
876        #[inline(always)]
877        fn encode_is_copy() -> bool {
878            true
879        }
880
881        #[inline(always)]
882        fn decode_is_copy() -> bool {
883            true
884        }
885    }
886
887    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceStopRequest, D>
888        for &DeviceStopRequest
889    {
890        #[inline]
891        unsafe fn encode(
892            self,
893            encoder: &mut fidl::encoding::Encoder<'_, D>,
894            offset: usize,
895            _depth: fidl::encoding::Depth,
896        ) -> fidl::Result<()> {
897            encoder.debug_check_bounds::<DeviceStopRequest>(offset);
898            unsafe {
899                // Copy the object into the buffer.
900                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
901                (buf_ptr as *mut DeviceStopRequest)
902                    .write_unaligned((self as *const DeviceStopRequest).read());
903                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
904                // done second because the memcpy will write garbage to these bytes.
905            }
906            Ok(())
907        }
908    }
909    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
910        fidl::encoding::Encode<DeviceStopRequest, D> for (T0,)
911    {
912        #[inline]
913        unsafe fn encode(
914            self,
915            encoder: &mut fidl::encoding::Encoder<'_, D>,
916            offset: usize,
917            depth: fidl::encoding::Depth,
918        ) -> fidl::Result<()> {
919            encoder.debug_check_bounds::<DeviceStopRequest>(offset);
920            // Zero out padding regions. There's no need to apply masks
921            // because the unmasked parts will be overwritten by fields.
922            // Write the fields.
923            self.0.encode(encoder, offset + 0, depth)?;
924            Ok(())
925        }
926    }
927
928    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceStopRequest {
929        #[inline(always)]
930        fn new_empty() -> Self {
931            Self { id: fidl::new_empty!(u64, D) }
932        }
933
934        #[inline]
935        unsafe fn decode(
936            &mut self,
937            decoder: &mut fidl::encoding::Decoder<'_, D>,
938            offset: usize,
939            _depth: fidl::encoding::Depth,
940        ) -> fidl::Result<()> {
941            decoder.debug_check_bounds::<Self>(offset);
942            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
943            // Verify that padding bytes are zero.
944            // Copy from the buffer into the object.
945            unsafe {
946                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
947            }
948            Ok(())
949        }
950    }
951
952    impl fidl::encoding::ValueTypeMarker for DeviceGetTicksLeftResponse {
953        type Borrowed<'a> = &'a Self;
954        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
955            value
956        }
957    }
958
959    unsafe impl fidl::encoding::TypeMarker for DeviceGetTicksLeftResponse {
960        type Owned = Self;
961
962        #[inline(always)]
963        fn inline_align(_context: fidl::encoding::Context) -> usize {
964            8
965        }
966
967        #[inline(always)]
968        fn inline_size(_context: fidl::encoding::Context) -> usize {
969            8
970        }
971        #[inline(always)]
972        fn encode_is_copy() -> bool {
973            true
974        }
975
976        #[inline(always)]
977        fn decode_is_copy() -> bool {
978            true
979        }
980    }
981
982    unsafe impl<D: fidl::encoding::ResourceDialect>
983        fidl::encoding::Encode<DeviceGetTicksLeftResponse, D> for &DeviceGetTicksLeftResponse
984    {
985        #[inline]
986        unsafe fn encode(
987            self,
988            encoder: &mut fidl::encoding::Encoder<'_, D>,
989            offset: usize,
990            _depth: fidl::encoding::Depth,
991        ) -> fidl::Result<()> {
992            encoder.debug_check_bounds::<DeviceGetTicksLeftResponse>(offset);
993            unsafe {
994                // Copy the object into the buffer.
995                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
996                (buf_ptr as *mut DeviceGetTicksLeftResponse)
997                    .write_unaligned((self as *const DeviceGetTicksLeftResponse).read());
998                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
999                // done second because the memcpy will write garbage to these bytes.
1000            }
1001            Ok(())
1002        }
1003    }
1004    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
1005        fidl::encoding::Encode<DeviceGetTicksLeftResponse, D> for (T0,)
1006    {
1007        #[inline]
1008        unsafe fn encode(
1009            self,
1010            encoder: &mut fidl::encoding::Encoder<'_, D>,
1011            offset: usize,
1012            depth: fidl::encoding::Depth,
1013        ) -> fidl::Result<()> {
1014            encoder.debug_check_bounds::<DeviceGetTicksLeftResponse>(offset);
1015            // Zero out padding regions. There's no need to apply masks
1016            // because the unmasked parts will be overwritten by fields.
1017            // Write the fields.
1018            self.0.encode(encoder, offset + 0, depth)?;
1019            Ok(())
1020        }
1021    }
1022
1023    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1024        for DeviceGetTicksLeftResponse
1025    {
1026        #[inline(always)]
1027        fn new_empty() -> Self {
1028            Self { ticks: fidl::new_empty!(u64, D) }
1029        }
1030
1031        #[inline]
1032        unsafe fn decode(
1033            &mut self,
1034            decoder: &mut fidl::encoding::Decoder<'_, D>,
1035            offset: usize,
1036            _depth: fidl::encoding::Depth,
1037        ) -> fidl::Result<()> {
1038            decoder.debug_check_bounds::<Self>(offset);
1039            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1040            // Verify that padding bytes are zero.
1041            // Copy from the buffer into the object.
1042            unsafe {
1043                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
1044            }
1045            Ok(())
1046        }
1047    }
1048
1049    impl fidl::encoding::ValueTypeMarker for DeviceReadClockResponse {
1050        type Borrowed<'a> = &'a Self;
1051        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1052            value
1053        }
1054    }
1055
1056    unsafe impl fidl::encoding::TypeMarker for DeviceReadClockResponse {
1057        type Owned = Self;
1058
1059        #[inline(always)]
1060        fn inline_align(_context: fidl::encoding::Context) -> usize {
1061            8
1062        }
1063
1064        #[inline(always)]
1065        fn inline_size(_context: fidl::encoding::Context) -> usize {
1066            8
1067        }
1068        #[inline(always)]
1069        fn encode_is_copy() -> bool {
1070            true
1071        }
1072
1073        #[inline(always)]
1074        fn decode_is_copy() -> bool {
1075            true
1076        }
1077    }
1078
1079    unsafe impl<D: fidl::encoding::ResourceDialect>
1080        fidl::encoding::Encode<DeviceReadClockResponse, D> for &DeviceReadClockResponse
1081    {
1082        #[inline]
1083        unsafe fn encode(
1084            self,
1085            encoder: &mut fidl::encoding::Encoder<'_, D>,
1086            offset: usize,
1087            _depth: fidl::encoding::Depth,
1088        ) -> fidl::Result<()> {
1089            encoder.debug_check_bounds::<DeviceReadClockResponse>(offset);
1090            unsafe {
1091                // Copy the object into the buffer.
1092                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1093                (buf_ptr as *mut DeviceReadClockResponse)
1094                    .write_unaligned((self as *const DeviceReadClockResponse).read());
1095                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1096                // done second because the memcpy will write garbage to these bytes.
1097            }
1098            Ok(())
1099        }
1100    }
1101    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
1102        fidl::encoding::Encode<DeviceReadClockResponse, D> for (T0,)
1103    {
1104        #[inline]
1105        unsafe fn encode(
1106            self,
1107            encoder: &mut fidl::encoding::Encoder<'_, D>,
1108            offset: usize,
1109            depth: fidl::encoding::Depth,
1110        ) -> fidl::Result<()> {
1111            encoder.debug_check_bounds::<DeviceReadClockResponse>(offset);
1112            // Zero out padding regions. There's no need to apply masks
1113            // because the unmasked parts will be overwritten by fields.
1114            // Write the fields.
1115            self.0.encode(encoder, offset + 0, depth)?;
1116            Ok(())
1117        }
1118    }
1119
1120    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1121        for DeviceReadClockResponse
1122    {
1123        #[inline(always)]
1124        fn new_empty() -> Self {
1125            Self { ticks: fidl::new_empty!(u64, D) }
1126        }
1127
1128        #[inline]
1129        unsafe fn decode(
1130            &mut self,
1131            decoder: &mut fidl::encoding::Decoder<'_, D>,
1132            offset: usize,
1133            _depth: fidl::encoding::Depth,
1134        ) -> fidl::Result<()> {
1135            decoder.debug_check_bounds::<Self>(offset);
1136            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1137            // Verify that padding bytes are zero.
1138            // Copy from the buffer into the object.
1139            unsafe {
1140                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
1141            }
1142            Ok(())
1143        }
1144    }
1145
1146    impl fidl::encoding::ValueTypeMarker for DeviceReadTimerResponse {
1147        type Borrowed<'a> = &'a Self;
1148        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1149            value
1150        }
1151    }
1152
1153    unsafe impl fidl::encoding::TypeMarker for DeviceReadTimerResponse {
1154        type Owned = Self;
1155
1156        #[inline(always)]
1157        fn inline_align(_context: fidl::encoding::Context) -> usize {
1158            8
1159        }
1160
1161        #[inline(always)]
1162        fn inline_size(_context: fidl::encoding::Context) -> usize {
1163            8
1164        }
1165        #[inline(always)]
1166        fn encode_is_copy() -> bool {
1167            true
1168        }
1169
1170        #[inline(always)]
1171        fn decode_is_copy() -> bool {
1172            true
1173        }
1174    }
1175
1176    unsafe impl<D: fidl::encoding::ResourceDialect>
1177        fidl::encoding::Encode<DeviceReadTimerResponse, D> for &DeviceReadTimerResponse
1178    {
1179        #[inline]
1180        unsafe fn encode(
1181            self,
1182            encoder: &mut fidl::encoding::Encoder<'_, D>,
1183            offset: usize,
1184            _depth: fidl::encoding::Depth,
1185        ) -> fidl::Result<()> {
1186            encoder.debug_check_bounds::<DeviceReadTimerResponse>(offset);
1187            unsafe {
1188                // Copy the object into the buffer.
1189                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1190                (buf_ptr as *mut DeviceReadTimerResponse)
1191                    .write_unaligned((self as *const DeviceReadTimerResponse).read());
1192                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1193                // done second because the memcpy will write garbage to these bytes.
1194            }
1195            Ok(())
1196        }
1197    }
1198    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
1199        fidl::encoding::Encode<DeviceReadTimerResponse, D> for (T0,)
1200    {
1201        #[inline]
1202        unsafe fn encode(
1203            self,
1204            encoder: &mut fidl::encoding::Encoder<'_, D>,
1205            offset: usize,
1206            depth: fidl::encoding::Depth,
1207        ) -> fidl::Result<()> {
1208            encoder.debug_check_bounds::<DeviceReadTimerResponse>(offset);
1209            // Zero out padding regions. There's no need to apply masks
1210            // because the unmasked parts will be overwritten by fields.
1211            // Write the fields.
1212            self.0.encode(encoder, offset + 0, depth)?;
1213            Ok(())
1214        }
1215    }
1216
1217    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1218        for DeviceReadTimerResponse
1219    {
1220        #[inline(always)]
1221        fn new_empty() -> Self {
1222            Self { ticks: fidl::new_empty!(u64, D) }
1223        }
1224
1225        #[inline]
1226        unsafe fn decode(
1227            &mut self,
1228            decoder: &mut fidl::encoding::Decoder<'_, D>,
1229            offset: usize,
1230            _depth: fidl::encoding::Depth,
1231        ) -> fidl::Result<()> {
1232            decoder.debug_check_bounds::<Self>(offset);
1233            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1234            // Verify that padding bytes are zero.
1235            // Copy from the buffer into the object.
1236            unsafe {
1237                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
1238            }
1239            Ok(())
1240        }
1241    }
1242
1243    impl TimerProperties {
1244        #[inline(always)]
1245        fn max_ordinal_present(&self) -> u64 {
1246            if let Some(_) = self.power_up_state {
1247                return 7;
1248            }
1249            if let Some(_) = self.supports_read {
1250                return 6;
1251            }
1252            if let Some(_) = self.supports_wait {
1253                return 5;
1254            }
1255            if let Some(_) = self.supports_event {
1256                return 4;
1257            }
1258            if let Some(_) = self.max_ticks {
1259                return 3;
1260            }
1261            if let Some(_) = self.supported_resolutions {
1262                return 2;
1263            }
1264            if let Some(_) = self.id {
1265                return 1;
1266            }
1267            0
1268        }
1269    }
1270
1271    impl fidl::encoding::ValueTypeMarker for TimerProperties {
1272        type Borrowed<'a> = &'a Self;
1273        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1274            value
1275        }
1276    }
1277
1278    unsafe impl fidl::encoding::TypeMarker for TimerProperties {
1279        type Owned = Self;
1280
1281        #[inline(always)]
1282        fn inline_align(_context: fidl::encoding::Context) -> usize {
1283            8
1284        }
1285
1286        #[inline(always)]
1287        fn inline_size(_context: fidl::encoding::Context) -> usize {
1288            16
1289        }
1290    }
1291
1292    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TimerProperties, D>
1293        for &TimerProperties
1294    {
1295        unsafe fn encode(
1296            self,
1297            encoder: &mut fidl::encoding::Encoder<'_, D>,
1298            offset: usize,
1299            mut depth: fidl::encoding::Depth,
1300        ) -> fidl::Result<()> {
1301            encoder.debug_check_bounds::<TimerProperties>(offset);
1302            // Vector header
1303            let max_ordinal: u64 = self.max_ordinal_present();
1304            encoder.write_num(max_ordinal, offset);
1305            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1306            // Calling encoder.out_of_line_offset(0) is not allowed.
1307            if max_ordinal == 0 {
1308                return Ok(());
1309            }
1310            depth.increment()?;
1311            let envelope_size = 8;
1312            let bytes_len = max_ordinal as usize * envelope_size;
1313            #[allow(unused_variables)]
1314            let offset = encoder.out_of_line_offset(bytes_len);
1315            let mut _prev_end_offset: usize = 0;
1316            if 1 > max_ordinal {
1317                return Ok(());
1318            }
1319
1320            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1321            // are envelope_size bytes.
1322            let cur_offset: usize = (1 - 1) * envelope_size;
1323
1324            // Zero reserved fields.
1325            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1326
1327            // Safety:
1328            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1329            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1330            //   envelope_size bytes, there is always sufficient room.
1331            fidl::encoding::encode_in_envelope_optional::<u64, D>(
1332                self.id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
1333                encoder,
1334                offset + cur_offset,
1335                depth,
1336            )?;
1337
1338            _prev_end_offset = cur_offset + envelope_size;
1339            if 2 > max_ordinal {
1340                return Ok(());
1341            }
1342
1343            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1344            // are envelope_size bytes.
1345            let cur_offset: usize = (2 - 1) * envelope_size;
1346
1347            // Zero reserved fields.
1348            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1349
1350            // Safety:
1351            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1352            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1353            //   envelope_size bytes, there is always sufficient room.
1354            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<Resolution, 64>, D>(
1355            self.supported_resolutions.as_ref().map(<fidl::encoding::Vector<Resolution, 64> as fidl::encoding::ValueTypeMarker>::borrow),
1356            encoder, offset + cur_offset, depth
1357        )?;
1358
1359            _prev_end_offset = cur_offset + envelope_size;
1360            if 3 > max_ordinal {
1361                return Ok(());
1362            }
1363
1364            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1365            // are envelope_size bytes.
1366            let cur_offset: usize = (3 - 1) * envelope_size;
1367
1368            // Zero reserved fields.
1369            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1370
1371            // Safety:
1372            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1373            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1374            //   envelope_size bytes, there is always sufficient room.
1375            fidl::encoding::encode_in_envelope_optional::<u64, D>(
1376                self.max_ticks.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
1377                encoder,
1378                offset + cur_offset,
1379                depth,
1380            )?;
1381
1382            _prev_end_offset = cur_offset + envelope_size;
1383            if 4 > max_ordinal {
1384                return Ok(());
1385            }
1386
1387            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1388            // are envelope_size bytes.
1389            let cur_offset: usize = (4 - 1) * envelope_size;
1390
1391            // Zero reserved fields.
1392            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1393
1394            // Safety:
1395            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1396            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1397            //   envelope_size bytes, there is always sufficient room.
1398            fidl::encoding::encode_in_envelope_optional::<bool, D>(
1399                self.supports_event.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1400                encoder,
1401                offset + cur_offset,
1402                depth,
1403            )?;
1404
1405            _prev_end_offset = cur_offset + envelope_size;
1406            if 5 > max_ordinal {
1407                return Ok(());
1408            }
1409
1410            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1411            // are envelope_size bytes.
1412            let cur_offset: usize = (5 - 1) * envelope_size;
1413
1414            // Zero reserved fields.
1415            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1416
1417            // Safety:
1418            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1419            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1420            //   envelope_size bytes, there is always sufficient room.
1421            fidl::encoding::encode_in_envelope_optional::<bool, D>(
1422                self.supports_wait.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1423                encoder,
1424                offset + cur_offset,
1425                depth,
1426            )?;
1427
1428            _prev_end_offset = cur_offset + envelope_size;
1429            if 6 > max_ordinal {
1430                return Ok(());
1431            }
1432
1433            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1434            // are envelope_size bytes.
1435            let cur_offset: usize = (6 - 1) * envelope_size;
1436
1437            // Zero reserved fields.
1438            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1439
1440            // Safety:
1441            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1442            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1443            //   envelope_size bytes, there is always sufficient room.
1444            fidl::encoding::encode_in_envelope_optional::<bool, D>(
1445                self.supports_read.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1446                encoder,
1447                offset + cur_offset,
1448                depth,
1449            )?;
1450
1451            _prev_end_offset = cur_offset + envelope_size;
1452            if 7 > max_ordinal {
1453                return Ok(());
1454            }
1455
1456            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1457            // are envelope_size bytes.
1458            let cur_offset: usize = (7 - 1) * envelope_size;
1459
1460            // Zero reserved fields.
1461            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1462
1463            // Safety:
1464            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1465            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1466            //   envelope_size bytes, there is always sufficient room.
1467            fidl::encoding::encode_in_envelope_optional::<PowerUpState, D>(
1468                self.power_up_state
1469                    .as_ref()
1470                    .map(<PowerUpState as fidl::encoding::ValueTypeMarker>::borrow),
1471                encoder,
1472                offset + cur_offset,
1473                depth,
1474            )?;
1475
1476            _prev_end_offset = cur_offset + envelope_size;
1477
1478            Ok(())
1479        }
1480    }
1481
1482    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TimerProperties {
1483        #[inline(always)]
1484        fn new_empty() -> Self {
1485            Self::default()
1486        }
1487
1488        unsafe fn decode(
1489            &mut self,
1490            decoder: &mut fidl::encoding::Decoder<'_, D>,
1491            offset: usize,
1492            mut depth: fidl::encoding::Depth,
1493        ) -> fidl::Result<()> {
1494            decoder.debug_check_bounds::<Self>(offset);
1495            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1496                None => return Err(fidl::Error::NotNullable),
1497                Some(len) => len,
1498            };
1499            // Calling decoder.out_of_line_offset(0) is not allowed.
1500            if len == 0 {
1501                return Ok(());
1502            };
1503            depth.increment()?;
1504            let envelope_size = 8;
1505            let bytes_len = len * envelope_size;
1506            let offset = decoder.out_of_line_offset(bytes_len)?;
1507            // Decode the envelope for each type.
1508            let mut _next_ordinal_to_read = 0;
1509            let mut next_offset = offset;
1510            let end_offset = offset + bytes_len;
1511            _next_ordinal_to_read += 1;
1512            if next_offset >= end_offset {
1513                return Ok(());
1514            }
1515
1516            // Decode unknown envelopes for gaps in ordinals.
1517            while _next_ordinal_to_read < 1 {
1518                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1519                _next_ordinal_to_read += 1;
1520                next_offset += envelope_size;
1521            }
1522
1523            let next_out_of_line = decoder.next_out_of_line();
1524            let handles_before = decoder.remaining_handles();
1525            if let Some((inlined, num_bytes, num_handles)) =
1526                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1527            {
1528                let member_inline_size =
1529                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1530                if inlined != (member_inline_size <= 4) {
1531                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1532                }
1533                let inner_offset;
1534                let mut inner_depth = depth.clone();
1535                if inlined {
1536                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1537                    inner_offset = next_offset;
1538                } else {
1539                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1540                    inner_depth.increment()?;
1541                }
1542                let val_ref = self.id.get_or_insert_with(|| fidl::new_empty!(u64, D));
1543                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
1544                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1545                {
1546                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1547                }
1548                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1549                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1550                }
1551            }
1552
1553            next_offset += envelope_size;
1554            _next_ordinal_to_read += 1;
1555            if next_offset >= end_offset {
1556                return Ok(());
1557            }
1558
1559            // Decode unknown envelopes for gaps in ordinals.
1560            while _next_ordinal_to_read < 2 {
1561                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1562                _next_ordinal_to_read += 1;
1563                next_offset += envelope_size;
1564            }
1565
1566            let next_out_of_line = decoder.next_out_of_line();
1567            let handles_before = decoder.remaining_handles();
1568            if let Some((inlined, num_bytes, num_handles)) =
1569                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1570            {
1571                let member_inline_size = <fidl::encoding::Vector<Resolution, 64> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1572                if inlined != (member_inline_size <= 4) {
1573                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1574                }
1575                let inner_offset;
1576                let mut inner_depth = depth.clone();
1577                if inlined {
1578                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1579                    inner_offset = next_offset;
1580                } else {
1581                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1582                    inner_depth.increment()?;
1583                }
1584                let val_ref = self.supported_resolutions.get_or_insert_with(
1585                    || fidl::new_empty!(fidl::encoding::Vector<Resolution, 64>, D),
1586                );
1587                fidl::decode!(fidl::encoding::Vector<Resolution, 64>, D, val_ref, decoder, inner_offset, inner_depth)?;
1588                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1589                {
1590                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1591                }
1592                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1593                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1594                }
1595            }
1596
1597            next_offset += envelope_size;
1598            _next_ordinal_to_read += 1;
1599            if next_offset >= end_offset {
1600                return Ok(());
1601            }
1602
1603            // Decode unknown envelopes for gaps in ordinals.
1604            while _next_ordinal_to_read < 3 {
1605                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1606                _next_ordinal_to_read += 1;
1607                next_offset += envelope_size;
1608            }
1609
1610            let next_out_of_line = decoder.next_out_of_line();
1611            let handles_before = decoder.remaining_handles();
1612            if let Some((inlined, num_bytes, num_handles)) =
1613                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1614            {
1615                let member_inline_size =
1616                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1617                if inlined != (member_inline_size <= 4) {
1618                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1619                }
1620                let inner_offset;
1621                let mut inner_depth = depth.clone();
1622                if inlined {
1623                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1624                    inner_offset = next_offset;
1625                } else {
1626                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1627                    inner_depth.increment()?;
1628                }
1629                let val_ref = self.max_ticks.get_or_insert_with(|| fidl::new_empty!(u64, D));
1630                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
1631                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1632                {
1633                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1634                }
1635                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1636                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1637                }
1638            }
1639
1640            next_offset += envelope_size;
1641            _next_ordinal_to_read += 1;
1642            if next_offset >= end_offset {
1643                return Ok(());
1644            }
1645
1646            // Decode unknown envelopes for gaps in ordinals.
1647            while _next_ordinal_to_read < 4 {
1648                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1649                _next_ordinal_to_read += 1;
1650                next_offset += envelope_size;
1651            }
1652
1653            let next_out_of_line = decoder.next_out_of_line();
1654            let handles_before = decoder.remaining_handles();
1655            if let Some((inlined, num_bytes, num_handles)) =
1656                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1657            {
1658                let member_inline_size =
1659                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1660                if inlined != (member_inline_size <= 4) {
1661                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1662                }
1663                let inner_offset;
1664                let mut inner_depth = depth.clone();
1665                if inlined {
1666                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1667                    inner_offset = next_offset;
1668                } else {
1669                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1670                    inner_depth.increment()?;
1671                }
1672                let val_ref = self.supports_event.get_or_insert_with(|| fidl::new_empty!(bool, D));
1673                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
1674                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1675                {
1676                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1677                }
1678                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1679                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1680                }
1681            }
1682
1683            next_offset += envelope_size;
1684            _next_ordinal_to_read += 1;
1685            if next_offset >= end_offset {
1686                return Ok(());
1687            }
1688
1689            // Decode unknown envelopes for gaps in ordinals.
1690            while _next_ordinal_to_read < 5 {
1691                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1692                _next_ordinal_to_read += 1;
1693                next_offset += envelope_size;
1694            }
1695
1696            let next_out_of_line = decoder.next_out_of_line();
1697            let handles_before = decoder.remaining_handles();
1698            if let Some((inlined, num_bytes, num_handles)) =
1699                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1700            {
1701                let member_inline_size =
1702                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1703                if inlined != (member_inline_size <= 4) {
1704                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1705                }
1706                let inner_offset;
1707                let mut inner_depth = depth.clone();
1708                if inlined {
1709                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1710                    inner_offset = next_offset;
1711                } else {
1712                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1713                    inner_depth.increment()?;
1714                }
1715                let val_ref = self.supports_wait.get_or_insert_with(|| fidl::new_empty!(bool, D));
1716                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
1717                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1718                {
1719                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1720                }
1721                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1722                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1723                }
1724            }
1725
1726            next_offset += envelope_size;
1727            _next_ordinal_to_read += 1;
1728            if next_offset >= end_offset {
1729                return Ok(());
1730            }
1731
1732            // Decode unknown envelopes for gaps in ordinals.
1733            while _next_ordinal_to_read < 6 {
1734                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1735                _next_ordinal_to_read += 1;
1736                next_offset += envelope_size;
1737            }
1738
1739            let next_out_of_line = decoder.next_out_of_line();
1740            let handles_before = decoder.remaining_handles();
1741            if let Some((inlined, num_bytes, num_handles)) =
1742                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1743            {
1744                let member_inline_size =
1745                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1746                if inlined != (member_inline_size <= 4) {
1747                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1748                }
1749                let inner_offset;
1750                let mut inner_depth = depth.clone();
1751                if inlined {
1752                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1753                    inner_offset = next_offset;
1754                } else {
1755                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1756                    inner_depth.increment()?;
1757                }
1758                let val_ref = self.supports_read.get_or_insert_with(|| fidl::new_empty!(bool, D));
1759                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
1760                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1761                {
1762                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1763                }
1764                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1765                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1766                }
1767            }
1768
1769            next_offset += envelope_size;
1770            _next_ordinal_to_read += 1;
1771            if next_offset >= end_offset {
1772                return Ok(());
1773            }
1774
1775            // Decode unknown envelopes for gaps in ordinals.
1776            while _next_ordinal_to_read < 7 {
1777                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1778                _next_ordinal_to_read += 1;
1779                next_offset += envelope_size;
1780            }
1781
1782            let next_out_of_line = decoder.next_out_of_line();
1783            let handles_before = decoder.remaining_handles();
1784            if let Some((inlined, num_bytes, num_handles)) =
1785                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1786            {
1787                let member_inline_size =
1788                    <PowerUpState as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1789                if inlined != (member_inline_size <= 4) {
1790                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1791                }
1792                let inner_offset;
1793                let mut inner_depth = depth.clone();
1794                if inlined {
1795                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1796                    inner_offset = next_offset;
1797                } else {
1798                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1799                    inner_depth.increment()?;
1800                }
1801                let val_ref =
1802                    self.power_up_state.get_or_insert_with(|| fidl::new_empty!(PowerUpState, D));
1803                fidl::decode!(PowerUpState, D, val_ref, decoder, inner_offset, inner_depth)?;
1804                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1805                {
1806                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1807                }
1808                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1809                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1810                }
1811            }
1812
1813            next_offset += envelope_size;
1814
1815            // Decode the remaining unknown envelopes.
1816            while next_offset < end_offset {
1817                _next_ordinal_to_read += 1;
1818                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1819                next_offset += envelope_size;
1820            }
1821
1822            Ok(())
1823        }
1824    }
1825
1826    impl fidl::encoding::ValueTypeMarker for Resolution {
1827        type Borrowed<'a> = &'a Self;
1828        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1829            value
1830        }
1831    }
1832
1833    unsafe impl fidl::encoding::TypeMarker for Resolution {
1834        type Owned = Self;
1835
1836        #[inline(always)]
1837        fn inline_align(_context: fidl::encoding::Context) -> usize {
1838            8
1839        }
1840
1841        #[inline(always)]
1842        fn inline_size(_context: fidl::encoding::Context) -> usize {
1843            16
1844        }
1845    }
1846
1847    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Resolution, D>
1848        for &Resolution
1849    {
1850        #[inline]
1851        unsafe fn encode(
1852            self,
1853            encoder: &mut fidl::encoding::Encoder<'_, D>,
1854            offset: usize,
1855            _depth: fidl::encoding::Depth,
1856        ) -> fidl::Result<()> {
1857            encoder.debug_check_bounds::<Resolution>(offset);
1858            encoder.write_num::<u64>(self.ordinal(), offset);
1859            match self {
1860                Resolution::Duration(ref val) => fidl::encoding::encode_in_envelope::<i64, D>(
1861                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(val),
1862                    encoder,
1863                    offset + 8,
1864                    _depth,
1865                ),
1866                Resolution::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
1867            }
1868        }
1869    }
1870
1871    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Resolution {
1872        #[inline(always)]
1873        fn new_empty() -> Self {
1874            Self::__SourceBreaking { unknown_ordinal: 0 }
1875        }
1876
1877        #[inline]
1878        unsafe fn decode(
1879            &mut self,
1880            decoder: &mut fidl::encoding::Decoder<'_, D>,
1881            offset: usize,
1882            mut depth: fidl::encoding::Depth,
1883        ) -> fidl::Result<()> {
1884            decoder.debug_check_bounds::<Self>(offset);
1885            #[allow(unused_variables)]
1886            let next_out_of_line = decoder.next_out_of_line();
1887            let handles_before = decoder.remaining_handles();
1888            let (ordinal, inlined, num_bytes, num_handles) =
1889                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
1890
1891            let member_inline_size = match ordinal {
1892                1 => <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1893                0 => return Err(fidl::Error::UnknownUnionTag),
1894                _ => num_bytes as usize,
1895            };
1896
1897            if inlined != (member_inline_size <= 4) {
1898                return Err(fidl::Error::InvalidInlineBitInEnvelope);
1899            }
1900            let _inner_offset;
1901            if inlined {
1902                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
1903                _inner_offset = offset + 8;
1904            } else {
1905                depth.increment()?;
1906                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1907            }
1908            match ordinal {
1909                1 => {
1910                    #[allow(irrefutable_let_patterns)]
1911                    if let Resolution::Duration(_) = self {
1912                        // Do nothing, read the value into the object
1913                    } else {
1914                        // Initialize `self` to the right variant
1915                        *self = Resolution::Duration(fidl::new_empty!(i64, D));
1916                    }
1917                    #[allow(irrefutable_let_patterns)]
1918                    if let Resolution::Duration(ref mut val) = self {
1919                        fidl::decode!(i64, D, val, decoder, _inner_offset, depth)?;
1920                    } else {
1921                        unreachable!()
1922                    }
1923                }
1924                #[allow(deprecated)]
1925                ordinal => {
1926                    for _ in 0..num_handles {
1927                        decoder.drop_next_handle()?;
1928                    }
1929                    *self = Resolution::__SourceBreaking { unknown_ordinal: ordinal };
1930                }
1931            }
1932            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
1933                return Err(fidl::Error::InvalidNumBytesInEnvelope);
1934            }
1935            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1936                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1937            }
1938            Ok(())
1939        }
1940    }
1941}