fidl_fuchsia_time_external_common/
fidl_fuchsia_time_external_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/// Enum of reasons why producing a time sample failed.
12#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
13#[repr(u32)]
14pub enum Error {
15    /// An error occurred that cannot be classified as one of the more specific
16    /// error statuses.
17    Unknown = 1,
18    /// An internal error occurred. This usually indicates a bug in the
19    /// component implementation.
20    Internal = 2,
21    /// A local resource error occurred such as IO, FIDL, or memory allocation
22    /// failure.
23    Resource = 3,
24    /// A network error occurred.
25    Network = 4,
26    /// Some hardware that the time source depends on failed.
27    Hardware = 5,
28    /// A retriable error specific to the implemented time protocol occurred,
29    /// such as a malformed response from a remote server.
30    Protocol = 6,
31    /// Sampling failed in a nonretriable way. Examples include failed
32    /// authentication, or a missing configuration.
33    ProtocolUnrecoverable = 7,
34    /// The request was made too soon and the client should wait before making
35    /// another request.
36    RateLimited = 8,
37}
38
39impl Error {
40    #[inline]
41    pub fn from_primitive(prim: u32) -> Option<Self> {
42        match prim {
43            1 => Some(Self::Unknown),
44            2 => Some(Self::Internal),
45            3 => Some(Self::Resource),
46            4 => Some(Self::Network),
47            5 => Some(Self::Hardware),
48            6 => Some(Self::Protocol),
49            7 => Some(Self::ProtocolUnrecoverable),
50            8 => Some(Self::RateLimited),
51            _ => None,
52        }
53    }
54
55    #[inline]
56    pub const fn into_primitive(self) -> u32 {
57        self as u32
58    }
59}
60
61/// Enum of states a PushSource may be in.
62#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
63#[repr(u32)]
64pub enum Status {
65    /// The time source is performing setup steps or waiting for dependencies
66    /// such as network to become available.
67    Initializing = 0,
68    /// The time source is healthy and expects to produce time samples.
69    Ok = 1,
70    /// The time source does not expect to produce time samples for reasons that
71    /// cannot be classified as one of the more specific statuses.
72    UnknownUnhealthy = 2,
73    /// The time source is unable to produce time samples due to network
74    /// availability issues.
75    Network = 3,
76    /// The time source is unable to produce time samples due to hardware
77    /// issues.
78    Hardware = 4,
79    /// The time source is unable to produce time samples due to errors specific
80    /// to the implemented time protocol.
81    Protocol = 5,
82    /// The time source is unable to produce time samples due to local resource
83    /// errors such as IO, FIDL, or memory allocation.
84    Resource = 6,
85}
86
87impl Status {
88    #[inline]
89    pub fn from_primitive(prim: u32) -> Option<Self> {
90        match prim {
91            0 => Some(Self::Initializing),
92            1 => Some(Self::Ok),
93            2 => Some(Self::UnknownUnhealthy),
94            3 => Some(Self::Network),
95            4 => Some(Self::Hardware),
96            5 => Some(Self::Protocol),
97            6 => Some(Self::Resource),
98            _ => None,
99        }
100    }
101
102    #[inline]
103    pub const fn into_primitive(self) -> u32 {
104        self as u32
105    }
106}
107
108/// Enum of urgencies used when requesting a sample from a PullSource. The time
109/// source may use this information to balance the need to produce a response
110/// quickly against the desire to produce an accurate sample.
111#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
112pub enum Urgency {
113    /// The client is blocked until the requested sample is received. For
114    /// example, the sample may be required to start a clock for the first time.
115    High,
116    /// The client will receive a significant benefit from the requested sample.
117    /// For example, the sample may be required to set the error bound on a
118    /// clock that is running with unknown accuracy.
119    Medium,
120    /// The client can wait as long as needed to receive a high-quality sample.
121    /// For example, the sample may be required for a periodic update on a clock
122    /// that is already running within an acceptable error bound.
123    Low,
124    #[doc(hidden)]
125    __SourceBreaking { unknown_ordinal: u32 },
126}
127
128/// Pattern that matches an unknown `Urgency` member.
129#[macro_export]
130macro_rules! UrgencyUnknown {
131    () => {
132        _
133    };
134}
135
136impl Urgency {
137    #[inline]
138    pub fn from_primitive(prim: u32) -> Option<Self> {
139        match prim {
140            1 => Some(Self::High),
141            2 => Some(Self::Medium),
142            3 => Some(Self::Low),
143            _ => None,
144        }
145    }
146
147    #[inline]
148    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
149        match prim {
150            1 => Self::High,
151            2 => Self::Medium,
152            3 => Self::Low,
153            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
154        }
155    }
156
157    #[inline]
158    pub fn unknown() -> Self {
159        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
160    }
161
162    #[inline]
163    pub const fn into_primitive(self) -> u32 {
164        match self {
165            Self::High => 1,
166            Self::Medium => 2,
167            Self::Low => 3,
168            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
169        }
170    }
171
172    #[inline]
173    pub fn is_unknown(&self) -> bool {
174        match self {
175            Self::__SourceBreaking { unknown_ordinal: _ } => true,
176            _ => false,
177        }
178    }
179}
180
181#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
182#[repr(C)]
183pub struct AdjustReportBootToUtcMappingRequest {
184    /// A time instant on the boot timeline, for which the caller is reporting
185    /// a presumed UTC reference instant.
186    pub boot_reference: fidl::BootInstant,
187    /// The time instant on the UTC timeline, corresponding to `boot_reference`.
188    pub utc_reference: i64,
189}
190
191impl fidl::Persistable for AdjustReportBootToUtcMappingRequest {}
192
193#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
194#[repr(C)]
195pub struct PullSourceNextPossibleSampleTimeResponse {
196    pub next_possible_time: i64,
197}
198
199impl fidl::Persistable for PullSourceNextPossibleSampleTimeResponse {}
200
201#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
202pub struct PullSourceSampleRequest {
203    pub urgency: Urgency,
204}
205
206impl fidl::Persistable for PullSourceSampleRequest {}
207
208#[derive(Clone, Debug, PartialEq)]
209pub struct PullSourceSampleResponse {
210    pub sample: TimeSample,
211}
212
213impl fidl::Persistable for PullSourceSampleResponse {}
214
215#[derive(Clone, Debug, PartialEq)]
216pub struct PushSourceWatchSampleResponse {
217    pub sample: TimeSample,
218}
219
220impl fidl::Persistable for PushSourceWatchSampleResponse {}
221
222#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
223pub struct PushSourceWatchStatusResponse {
224    pub status: Status,
225}
226
227impl fidl::Persistable for PushSourceWatchStatusResponse {}
228
229#[derive(Clone, Debug, PartialEq)]
230pub struct TimeSourceUpdateDevicePropertiesRequest {
231    pub properties: Properties,
232}
233
234impl fidl::Persistable for TimeSourceUpdateDevicePropertiesRequest {}
235
236/// Device global properties a time source may use to help it sample time.
237#[derive(Clone, Debug, Default, PartialEq)]
238pub struct Properties {
239    #[doc(hidden)]
240    pub __source_breaking: fidl::marker::SourceBreaking,
241}
242
243impl fidl::Persistable for Properties {}
244
245/// A correspondence pair that describes a UTC and the reference clock readings
246/// at the measurement instant.
247#[derive(Clone, Debug, Default, PartialEq)]
248pub struct TimeSample {
249    /// The UTC time sample.  The value of this instant is a value on the UTC
250    /// timeline. However, the field is not type safe, as there is no UTC
251    /// specific type on the zx level.
252    pub utc: Option<i64>,
253    /// The monotonic time at which the sample was most valid. Must always be
254    /// provided.
255    /// DEPRECATED. Use `reference` below instead.
256    pub monotonic: Option<i64>,
257    /// The standard deviation representing the error distribution of the UTC
258    /// measurement. Must always be provided.
259    pub standard_deviation: Option<i64>,
260    /// The timestamp on the reference timeline at which the sample was most
261    /// valid. Must always be provided.  The reference timeline is tracking
262    /// the rate of change of proper time [1].  So, for example, Fuchsia's boot
263    /// timeline will generate the appropriate reference instant.
264    ///
265    /// [1]: https://en.wikipedia.org/wiki/Proper_time
266    pub reference: Option<fidl::BootInstant>,
267    #[doc(hidden)]
268    pub __source_breaking: fidl::marker::SourceBreaking,
269}
270
271impl fidl::Persistable for TimeSample {}
272
273mod internal {
274    use super::*;
275    unsafe impl fidl::encoding::TypeMarker for Error {
276        type Owned = Self;
277
278        #[inline(always)]
279        fn inline_align(_context: fidl::encoding::Context) -> usize {
280            std::mem::align_of::<u32>()
281        }
282
283        #[inline(always)]
284        fn inline_size(_context: fidl::encoding::Context) -> usize {
285            std::mem::size_of::<u32>()
286        }
287
288        #[inline(always)]
289        fn encode_is_copy() -> bool {
290            true
291        }
292
293        #[inline(always)]
294        fn decode_is_copy() -> bool {
295            false
296        }
297    }
298
299    impl fidl::encoding::ValueTypeMarker for Error {
300        type Borrowed<'a> = Self;
301        #[inline(always)]
302        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
303            *value
304        }
305    }
306
307    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Error {
308        #[inline]
309        unsafe fn encode(
310            self,
311            encoder: &mut fidl::encoding::Encoder<'_, D>,
312            offset: usize,
313            _depth: fidl::encoding::Depth,
314        ) -> fidl::Result<()> {
315            encoder.debug_check_bounds::<Self>(offset);
316            encoder.write_num(self.into_primitive(), offset);
317            Ok(())
318        }
319    }
320
321    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Error {
322        #[inline(always)]
323        fn new_empty() -> Self {
324            Self::Unknown
325        }
326
327        #[inline]
328        unsafe fn decode(
329            &mut self,
330            decoder: &mut fidl::encoding::Decoder<'_, D>,
331            offset: usize,
332            _depth: fidl::encoding::Depth,
333        ) -> fidl::Result<()> {
334            decoder.debug_check_bounds::<Self>(offset);
335            let prim = decoder.read_num::<u32>(offset);
336
337            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
338            Ok(())
339        }
340    }
341    unsafe impl fidl::encoding::TypeMarker for Status {
342        type Owned = Self;
343
344        #[inline(always)]
345        fn inline_align(_context: fidl::encoding::Context) -> usize {
346            std::mem::align_of::<u32>()
347        }
348
349        #[inline(always)]
350        fn inline_size(_context: fidl::encoding::Context) -> usize {
351            std::mem::size_of::<u32>()
352        }
353
354        #[inline(always)]
355        fn encode_is_copy() -> bool {
356            true
357        }
358
359        #[inline(always)]
360        fn decode_is_copy() -> bool {
361            false
362        }
363    }
364
365    impl fidl::encoding::ValueTypeMarker for Status {
366        type Borrowed<'a> = Self;
367        #[inline(always)]
368        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
369            *value
370        }
371    }
372
373    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Status {
374        #[inline]
375        unsafe fn encode(
376            self,
377            encoder: &mut fidl::encoding::Encoder<'_, D>,
378            offset: usize,
379            _depth: fidl::encoding::Depth,
380        ) -> fidl::Result<()> {
381            encoder.debug_check_bounds::<Self>(offset);
382            encoder.write_num(self.into_primitive(), offset);
383            Ok(())
384        }
385    }
386
387    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Status {
388        #[inline(always)]
389        fn new_empty() -> Self {
390            Self::Initializing
391        }
392
393        #[inline]
394        unsafe fn decode(
395            &mut self,
396            decoder: &mut fidl::encoding::Decoder<'_, D>,
397            offset: usize,
398            _depth: fidl::encoding::Depth,
399        ) -> fidl::Result<()> {
400            decoder.debug_check_bounds::<Self>(offset);
401            let prim = decoder.read_num::<u32>(offset);
402
403            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
404            Ok(())
405        }
406    }
407    unsafe impl fidl::encoding::TypeMarker for Urgency {
408        type Owned = Self;
409
410        #[inline(always)]
411        fn inline_align(_context: fidl::encoding::Context) -> usize {
412            std::mem::align_of::<u32>()
413        }
414
415        #[inline(always)]
416        fn inline_size(_context: fidl::encoding::Context) -> usize {
417            std::mem::size_of::<u32>()
418        }
419
420        #[inline(always)]
421        fn encode_is_copy() -> bool {
422            false
423        }
424
425        #[inline(always)]
426        fn decode_is_copy() -> bool {
427            false
428        }
429    }
430
431    impl fidl::encoding::ValueTypeMarker for Urgency {
432        type Borrowed<'a> = Self;
433        #[inline(always)]
434        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
435            *value
436        }
437    }
438
439    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Urgency {
440        #[inline]
441        unsafe fn encode(
442            self,
443            encoder: &mut fidl::encoding::Encoder<'_, D>,
444            offset: usize,
445            _depth: fidl::encoding::Depth,
446        ) -> fidl::Result<()> {
447            encoder.debug_check_bounds::<Self>(offset);
448            encoder.write_num(self.into_primitive(), offset);
449            Ok(())
450        }
451    }
452
453    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Urgency {
454        #[inline(always)]
455        fn new_empty() -> Self {
456            Self::unknown()
457        }
458
459        #[inline]
460        unsafe fn decode(
461            &mut self,
462            decoder: &mut fidl::encoding::Decoder<'_, D>,
463            offset: usize,
464            _depth: fidl::encoding::Depth,
465        ) -> fidl::Result<()> {
466            decoder.debug_check_bounds::<Self>(offset);
467            let prim = decoder.read_num::<u32>(offset);
468
469            *self = Self::from_primitive_allow_unknown(prim);
470            Ok(())
471        }
472    }
473
474    impl fidl::encoding::ValueTypeMarker for AdjustReportBootToUtcMappingRequest {
475        type Borrowed<'a> = &'a Self;
476        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
477            value
478        }
479    }
480
481    unsafe impl fidl::encoding::TypeMarker for AdjustReportBootToUtcMappingRequest {
482        type Owned = Self;
483
484        #[inline(always)]
485        fn inline_align(_context: fidl::encoding::Context) -> usize {
486            8
487        }
488
489        #[inline(always)]
490        fn inline_size(_context: fidl::encoding::Context) -> usize {
491            16
492        }
493        #[inline(always)]
494        fn encode_is_copy() -> bool {
495            true
496        }
497
498        #[inline(always)]
499        fn decode_is_copy() -> bool {
500            true
501        }
502    }
503
504    unsafe impl<D: fidl::encoding::ResourceDialect>
505        fidl::encoding::Encode<AdjustReportBootToUtcMappingRequest, D>
506        for &AdjustReportBootToUtcMappingRequest
507    {
508        #[inline]
509        unsafe fn encode(
510            self,
511            encoder: &mut fidl::encoding::Encoder<'_, D>,
512            offset: usize,
513            _depth: fidl::encoding::Depth,
514        ) -> fidl::Result<()> {
515            encoder.debug_check_bounds::<AdjustReportBootToUtcMappingRequest>(offset);
516            unsafe {
517                // Copy the object into the buffer.
518                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
519                (buf_ptr as *mut AdjustReportBootToUtcMappingRequest)
520                    .write_unaligned((self as *const AdjustReportBootToUtcMappingRequest).read());
521                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
522                // done second because the memcpy will write garbage to these bytes.
523            }
524            Ok(())
525        }
526    }
527    unsafe impl<
528            D: fidl::encoding::ResourceDialect,
529            T0: fidl::encoding::Encode<fidl::BootInstant, D>,
530            T1: fidl::encoding::Encode<i64, D>,
531        > fidl::encoding::Encode<AdjustReportBootToUtcMappingRequest, D> for (T0, T1)
532    {
533        #[inline]
534        unsafe fn encode(
535            self,
536            encoder: &mut fidl::encoding::Encoder<'_, D>,
537            offset: usize,
538            depth: fidl::encoding::Depth,
539        ) -> fidl::Result<()> {
540            encoder.debug_check_bounds::<AdjustReportBootToUtcMappingRequest>(offset);
541            // Zero out padding regions. There's no need to apply masks
542            // because the unmasked parts will be overwritten by fields.
543            // Write the fields.
544            self.0.encode(encoder, offset + 0, depth)?;
545            self.1.encode(encoder, offset + 8, depth)?;
546            Ok(())
547        }
548    }
549
550    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
551        for AdjustReportBootToUtcMappingRequest
552    {
553        #[inline(always)]
554        fn new_empty() -> Self {
555            Self {
556                boot_reference: fidl::new_empty!(fidl::BootInstant, D),
557                utc_reference: fidl::new_empty!(i64, D),
558            }
559        }
560
561        #[inline]
562        unsafe fn decode(
563            &mut self,
564            decoder: &mut fidl::encoding::Decoder<'_, D>,
565            offset: usize,
566            _depth: fidl::encoding::Depth,
567        ) -> fidl::Result<()> {
568            decoder.debug_check_bounds::<Self>(offset);
569            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
570            // Verify that padding bytes are zero.
571            // Copy from the buffer into the object.
572            unsafe {
573                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
574            }
575            Ok(())
576        }
577    }
578
579    impl fidl::encoding::ValueTypeMarker for PullSourceNextPossibleSampleTimeResponse {
580        type Borrowed<'a> = &'a Self;
581        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
582            value
583        }
584    }
585
586    unsafe impl fidl::encoding::TypeMarker for PullSourceNextPossibleSampleTimeResponse {
587        type Owned = Self;
588
589        #[inline(always)]
590        fn inline_align(_context: fidl::encoding::Context) -> usize {
591            8
592        }
593
594        #[inline(always)]
595        fn inline_size(_context: fidl::encoding::Context) -> usize {
596            8
597        }
598        #[inline(always)]
599        fn encode_is_copy() -> bool {
600            true
601        }
602
603        #[inline(always)]
604        fn decode_is_copy() -> bool {
605            true
606        }
607    }
608
609    unsafe impl<D: fidl::encoding::ResourceDialect>
610        fidl::encoding::Encode<PullSourceNextPossibleSampleTimeResponse, D>
611        for &PullSourceNextPossibleSampleTimeResponse
612    {
613        #[inline]
614        unsafe fn encode(
615            self,
616            encoder: &mut fidl::encoding::Encoder<'_, D>,
617            offset: usize,
618            _depth: fidl::encoding::Depth,
619        ) -> fidl::Result<()> {
620            encoder.debug_check_bounds::<PullSourceNextPossibleSampleTimeResponse>(offset);
621            unsafe {
622                // Copy the object into the buffer.
623                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
624                (buf_ptr as *mut PullSourceNextPossibleSampleTimeResponse).write_unaligned(
625                    (self as *const PullSourceNextPossibleSampleTimeResponse).read(),
626                );
627                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
628                // done second because the memcpy will write garbage to these bytes.
629            }
630            Ok(())
631        }
632    }
633    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i64, D>>
634        fidl::encoding::Encode<PullSourceNextPossibleSampleTimeResponse, D> for (T0,)
635    {
636        #[inline]
637        unsafe fn encode(
638            self,
639            encoder: &mut fidl::encoding::Encoder<'_, D>,
640            offset: usize,
641            depth: fidl::encoding::Depth,
642        ) -> fidl::Result<()> {
643            encoder.debug_check_bounds::<PullSourceNextPossibleSampleTimeResponse>(offset);
644            // Zero out padding regions. There's no need to apply masks
645            // because the unmasked parts will be overwritten by fields.
646            // Write the fields.
647            self.0.encode(encoder, offset + 0, depth)?;
648            Ok(())
649        }
650    }
651
652    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
653        for PullSourceNextPossibleSampleTimeResponse
654    {
655        #[inline(always)]
656        fn new_empty() -> Self {
657            Self { next_possible_time: fidl::new_empty!(i64, D) }
658        }
659
660        #[inline]
661        unsafe fn decode(
662            &mut self,
663            decoder: &mut fidl::encoding::Decoder<'_, D>,
664            offset: usize,
665            _depth: fidl::encoding::Depth,
666        ) -> fidl::Result<()> {
667            decoder.debug_check_bounds::<Self>(offset);
668            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
669            // Verify that padding bytes are zero.
670            // Copy from the buffer into the object.
671            unsafe {
672                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
673            }
674            Ok(())
675        }
676    }
677
678    impl fidl::encoding::ValueTypeMarker for PullSourceSampleRequest {
679        type Borrowed<'a> = &'a Self;
680        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
681            value
682        }
683    }
684
685    unsafe impl fidl::encoding::TypeMarker for PullSourceSampleRequest {
686        type Owned = Self;
687
688        #[inline(always)]
689        fn inline_align(_context: fidl::encoding::Context) -> usize {
690            4
691        }
692
693        #[inline(always)]
694        fn inline_size(_context: fidl::encoding::Context) -> usize {
695            4
696        }
697    }
698
699    unsafe impl<D: fidl::encoding::ResourceDialect>
700        fidl::encoding::Encode<PullSourceSampleRequest, D> for &PullSourceSampleRequest
701    {
702        #[inline]
703        unsafe fn encode(
704            self,
705            encoder: &mut fidl::encoding::Encoder<'_, D>,
706            offset: usize,
707            _depth: fidl::encoding::Depth,
708        ) -> fidl::Result<()> {
709            encoder.debug_check_bounds::<PullSourceSampleRequest>(offset);
710            // Delegate to tuple encoding.
711            fidl::encoding::Encode::<PullSourceSampleRequest, D>::encode(
712                (<Urgency as fidl::encoding::ValueTypeMarker>::borrow(&self.urgency),),
713                encoder,
714                offset,
715                _depth,
716            )
717        }
718    }
719    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Urgency, D>>
720        fidl::encoding::Encode<PullSourceSampleRequest, D> for (T0,)
721    {
722        #[inline]
723        unsafe fn encode(
724            self,
725            encoder: &mut fidl::encoding::Encoder<'_, D>,
726            offset: usize,
727            depth: fidl::encoding::Depth,
728        ) -> fidl::Result<()> {
729            encoder.debug_check_bounds::<PullSourceSampleRequest>(offset);
730            // Zero out padding regions. There's no need to apply masks
731            // because the unmasked parts will be overwritten by fields.
732            // Write the fields.
733            self.0.encode(encoder, offset + 0, depth)?;
734            Ok(())
735        }
736    }
737
738    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
739        for PullSourceSampleRequest
740    {
741        #[inline(always)]
742        fn new_empty() -> Self {
743            Self { urgency: fidl::new_empty!(Urgency, 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!(Urgency, D, &mut self.urgency, decoder, offset + 0, _depth)?;
756            Ok(())
757        }
758    }
759
760    impl fidl::encoding::ValueTypeMarker for PullSourceSampleResponse {
761        type Borrowed<'a> = &'a Self;
762        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
763            value
764        }
765    }
766
767    unsafe impl fidl::encoding::TypeMarker for PullSourceSampleResponse {
768        type Owned = Self;
769
770        #[inline(always)]
771        fn inline_align(_context: fidl::encoding::Context) -> usize {
772            8
773        }
774
775        #[inline(always)]
776        fn inline_size(_context: fidl::encoding::Context) -> usize {
777            16
778        }
779    }
780
781    unsafe impl<D: fidl::encoding::ResourceDialect>
782        fidl::encoding::Encode<PullSourceSampleResponse, D> for &PullSourceSampleResponse
783    {
784        #[inline]
785        unsafe fn encode(
786            self,
787            encoder: &mut fidl::encoding::Encoder<'_, D>,
788            offset: usize,
789            _depth: fidl::encoding::Depth,
790        ) -> fidl::Result<()> {
791            encoder.debug_check_bounds::<PullSourceSampleResponse>(offset);
792            // Delegate to tuple encoding.
793            fidl::encoding::Encode::<PullSourceSampleResponse, D>::encode(
794                (<TimeSample as fidl::encoding::ValueTypeMarker>::borrow(&self.sample),),
795                encoder,
796                offset,
797                _depth,
798            )
799        }
800    }
801    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<TimeSample, D>>
802        fidl::encoding::Encode<PullSourceSampleResponse, D> for (T0,)
803    {
804        #[inline]
805        unsafe fn encode(
806            self,
807            encoder: &mut fidl::encoding::Encoder<'_, D>,
808            offset: usize,
809            depth: fidl::encoding::Depth,
810        ) -> fidl::Result<()> {
811            encoder.debug_check_bounds::<PullSourceSampleResponse>(offset);
812            // Zero out padding regions. There's no need to apply masks
813            // because the unmasked parts will be overwritten by fields.
814            // Write the fields.
815            self.0.encode(encoder, offset + 0, depth)?;
816            Ok(())
817        }
818    }
819
820    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
821        for PullSourceSampleResponse
822    {
823        #[inline(always)]
824        fn new_empty() -> Self {
825            Self { sample: fidl::new_empty!(TimeSample, D) }
826        }
827
828        #[inline]
829        unsafe fn decode(
830            &mut self,
831            decoder: &mut fidl::encoding::Decoder<'_, D>,
832            offset: usize,
833            _depth: fidl::encoding::Depth,
834        ) -> fidl::Result<()> {
835            decoder.debug_check_bounds::<Self>(offset);
836            // Verify that padding bytes are zero.
837            fidl::decode!(TimeSample, D, &mut self.sample, decoder, offset + 0, _depth)?;
838            Ok(())
839        }
840    }
841
842    impl fidl::encoding::ValueTypeMarker for PushSourceWatchSampleResponse {
843        type Borrowed<'a> = &'a Self;
844        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
845            value
846        }
847    }
848
849    unsafe impl fidl::encoding::TypeMarker for PushSourceWatchSampleResponse {
850        type Owned = Self;
851
852        #[inline(always)]
853        fn inline_align(_context: fidl::encoding::Context) -> usize {
854            8
855        }
856
857        #[inline(always)]
858        fn inline_size(_context: fidl::encoding::Context) -> usize {
859            16
860        }
861    }
862
863    unsafe impl<D: fidl::encoding::ResourceDialect>
864        fidl::encoding::Encode<PushSourceWatchSampleResponse, D>
865        for &PushSourceWatchSampleResponse
866    {
867        #[inline]
868        unsafe fn encode(
869            self,
870            encoder: &mut fidl::encoding::Encoder<'_, D>,
871            offset: usize,
872            _depth: fidl::encoding::Depth,
873        ) -> fidl::Result<()> {
874            encoder.debug_check_bounds::<PushSourceWatchSampleResponse>(offset);
875            // Delegate to tuple encoding.
876            fidl::encoding::Encode::<PushSourceWatchSampleResponse, D>::encode(
877                (<TimeSample as fidl::encoding::ValueTypeMarker>::borrow(&self.sample),),
878                encoder,
879                offset,
880                _depth,
881            )
882        }
883    }
884    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<TimeSample, D>>
885        fidl::encoding::Encode<PushSourceWatchSampleResponse, D> for (T0,)
886    {
887        #[inline]
888        unsafe fn encode(
889            self,
890            encoder: &mut fidl::encoding::Encoder<'_, D>,
891            offset: usize,
892            depth: fidl::encoding::Depth,
893        ) -> fidl::Result<()> {
894            encoder.debug_check_bounds::<PushSourceWatchSampleResponse>(offset);
895            // Zero out padding regions. There's no need to apply masks
896            // because the unmasked parts will be overwritten by fields.
897            // Write the fields.
898            self.0.encode(encoder, offset + 0, depth)?;
899            Ok(())
900        }
901    }
902
903    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
904        for PushSourceWatchSampleResponse
905    {
906        #[inline(always)]
907        fn new_empty() -> Self {
908            Self { sample: fidl::new_empty!(TimeSample, D) }
909        }
910
911        #[inline]
912        unsafe fn decode(
913            &mut self,
914            decoder: &mut fidl::encoding::Decoder<'_, D>,
915            offset: usize,
916            _depth: fidl::encoding::Depth,
917        ) -> fidl::Result<()> {
918            decoder.debug_check_bounds::<Self>(offset);
919            // Verify that padding bytes are zero.
920            fidl::decode!(TimeSample, D, &mut self.sample, decoder, offset + 0, _depth)?;
921            Ok(())
922        }
923    }
924
925    impl fidl::encoding::ValueTypeMarker for PushSourceWatchStatusResponse {
926        type Borrowed<'a> = &'a Self;
927        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
928            value
929        }
930    }
931
932    unsafe impl fidl::encoding::TypeMarker for PushSourceWatchStatusResponse {
933        type Owned = Self;
934
935        #[inline(always)]
936        fn inline_align(_context: fidl::encoding::Context) -> usize {
937            4
938        }
939
940        #[inline(always)]
941        fn inline_size(_context: fidl::encoding::Context) -> usize {
942            4
943        }
944    }
945
946    unsafe impl<D: fidl::encoding::ResourceDialect>
947        fidl::encoding::Encode<PushSourceWatchStatusResponse, D>
948        for &PushSourceWatchStatusResponse
949    {
950        #[inline]
951        unsafe fn encode(
952            self,
953            encoder: &mut fidl::encoding::Encoder<'_, D>,
954            offset: usize,
955            _depth: fidl::encoding::Depth,
956        ) -> fidl::Result<()> {
957            encoder.debug_check_bounds::<PushSourceWatchStatusResponse>(offset);
958            // Delegate to tuple encoding.
959            fidl::encoding::Encode::<PushSourceWatchStatusResponse, D>::encode(
960                (<Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),),
961                encoder,
962                offset,
963                _depth,
964            )
965        }
966    }
967    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Status, D>>
968        fidl::encoding::Encode<PushSourceWatchStatusResponse, D> for (T0,)
969    {
970        #[inline]
971        unsafe fn encode(
972            self,
973            encoder: &mut fidl::encoding::Encoder<'_, D>,
974            offset: usize,
975            depth: fidl::encoding::Depth,
976        ) -> fidl::Result<()> {
977            encoder.debug_check_bounds::<PushSourceWatchStatusResponse>(offset);
978            // Zero out padding regions. There's no need to apply masks
979            // because the unmasked parts will be overwritten by fields.
980            // Write the fields.
981            self.0.encode(encoder, offset + 0, depth)?;
982            Ok(())
983        }
984    }
985
986    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
987        for PushSourceWatchStatusResponse
988    {
989        #[inline(always)]
990        fn new_empty() -> Self {
991            Self { status: fidl::new_empty!(Status, D) }
992        }
993
994        #[inline]
995        unsafe fn decode(
996            &mut self,
997            decoder: &mut fidl::encoding::Decoder<'_, D>,
998            offset: usize,
999            _depth: fidl::encoding::Depth,
1000        ) -> fidl::Result<()> {
1001            decoder.debug_check_bounds::<Self>(offset);
1002            // Verify that padding bytes are zero.
1003            fidl::decode!(Status, D, &mut self.status, decoder, offset + 0, _depth)?;
1004            Ok(())
1005        }
1006    }
1007
1008    impl fidl::encoding::ValueTypeMarker for TimeSourceUpdateDevicePropertiesRequest {
1009        type Borrowed<'a> = &'a Self;
1010        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1011            value
1012        }
1013    }
1014
1015    unsafe impl fidl::encoding::TypeMarker for TimeSourceUpdateDevicePropertiesRequest {
1016        type Owned = Self;
1017
1018        #[inline(always)]
1019        fn inline_align(_context: fidl::encoding::Context) -> usize {
1020            8
1021        }
1022
1023        #[inline(always)]
1024        fn inline_size(_context: fidl::encoding::Context) -> usize {
1025            16
1026        }
1027    }
1028
1029    unsafe impl<D: fidl::encoding::ResourceDialect>
1030        fidl::encoding::Encode<TimeSourceUpdateDevicePropertiesRequest, D>
1031        for &TimeSourceUpdateDevicePropertiesRequest
1032    {
1033        #[inline]
1034        unsafe fn encode(
1035            self,
1036            encoder: &mut fidl::encoding::Encoder<'_, D>,
1037            offset: usize,
1038            _depth: fidl::encoding::Depth,
1039        ) -> fidl::Result<()> {
1040            encoder.debug_check_bounds::<TimeSourceUpdateDevicePropertiesRequest>(offset);
1041            // Delegate to tuple encoding.
1042            fidl::encoding::Encode::<TimeSourceUpdateDevicePropertiesRequest, D>::encode(
1043                (<Properties as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),),
1044                encoder,
1045                offset,
1046                _depth,
1047            )
1048        }
1049    }
1050    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Properties, D>>
1051        fidl::encoding::Encode<TimeSourceUpdateDevicePropertiesRequest, D> for (T0,)
1052    {
1053        #[inline]
1054        unsafe fn encode(
1055            self,
1056            encoder: &mut fidl::encoding::Encoder<'_, D>,
1057            offset: usize,
1058            depth: fidl::encoding::Depth,
1059        ) -> fidl::Result<()> {
1060            encoder.debug_check_bounds::<TimeSourceUpdateDevicePropertiesRequest>(offset);
1061            // Zero out padding regions. There's no need to apply masks
1062            // because the unmasked parts will be overwritten by fields.
1063            // Write the fields.
1064            self.0.encode(encoder, offset + 0, depth)?;
1065            Ok(())
1066        }
1067    }
1068
1069    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1070        for TimeSourceUpdateDevicePropertiesRequest
1071    {
1072        #[inline(always)]
1073        fn new_empty() -> Self {
1074            Self { properties: fidl::new_empty!(Properties, D) }
1075        }
1076
1077        #[inline]
1078        unsafe fn decode(
1079            &mut self,
1080            decoder: &mut fidl::encoding::Decoder<'_, D>,
1081            offset: usize,
1082            _depth: fidl::encoding::Depth,
1083        ) -> fidl::Result<()> {
1084            decoder.debug_check_bounds::<Self>(offset);
1085            // Verify that padding bytes are zero.
1086            fidl::decode!(Properties, D, &mut self.properties, decoder, offset + 0, _depth)?;
1087            Ok(())
1088        }
1089    }
1090
1091    impl Properties {
1092        #[inline(always)]
1093        fn max_ordinal_present(&self) -> u64 {
1094            0
1095        }
1096    }
1097
1098    impl fidl::encoding::ValueTypeMarker for Properties {
1099        type Borrowed<'a> = &'a Self;
1100        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1101            value
1102        }
1103    }
1104
1105    unsafe impl fidl::encoding::TypeMarker for Properties {
1106        type Owned = Self;
1107
1108        #[inline(always)]
1109        fn inline_align(_context: fidl::encoding::Context) -> usize {
1110            8
1111        }
1112
1113        #[inline(always)]
1114        fn inline_size(_context: fidl::encoding::Context) -> usize {
1115            16
1116        }
1117    }
1118
1119    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Properties, D>
1120        for &Properties
1121    {
1122        unsafe fn encode(
1123            self,
1124            encoder: &mut fidl::encoding::Encoder<'_, D>,
1125            offset: usize,
1126            mut depth: fidl::encoding::Depth,
1127        ) -> fidl::Result<()> {
1128            encoder.debug_check_bounds::<Properties>(offset);
1129            // Vector header
1130            let max_ordinal: u64 = self.max_ordinal_present();
1131            encoder.write_num(max_ordinal, offset);
1132            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1133            // Calling encoder.out_of_line_offset(0) is not allowed.
1134            if max_ordinal == 0 {
1135                return Ok(());
1136            }
1137            depth.increment()?;
1138            let envelope_size = 8;
1139            let bytes_len = max_ordinal as usize * envelope_size;
1140            #[allow(unused_variables)]
1141            let offset = encoder.out_of_line_offset(bytes_len);
1142            let mut _prev_end_offset: usize = 0;
1143
1144            Ok(())
1145        }
1146    }
1147
1148    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Properties {
1149        #[inline(always)]
1150        fn new_empty() -> Self {
1151            Self::default()
1152        }
1153
1154        unsafe fn decode(
1155            &mut self,
1156            decoder: &mut fidl::encoding::Decoder<'_, D>,
1157            offset: usize,
1158            mut depth: fidl::encoding::Depth,
1159        ) -> fidl::Result<()> {
1160            decoder.debug_check_bounds::<Self>(offset);
1161            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1162                None => return Err(fidl::Error::NotNullable),
1163                Some(len) => len,
1164            };
1165            // Calling decoder.out_of_line_offset(0) is not allowed.
1166            if len == 0 {
1167                return Ok(());
1168            };
1169            depth.increment()?;
1170            let envelope_size = 8;
1171            let bytes_len = len * envelope_size;
1172            let offset = decoder.out_of_line_offset(bytes_len)?;
1173            // Decode the envelope for each type.
1174            let mut _next_ordinal_to_read = 0;
1175            let mut next_offset = offset;
1176            let end_offset = offset + bytes_len;
1177
1178            // Decode the remaining unknown envelopes.
1179            while next_offset < end_offset {
1180                _next_ordinal_to_read += 1;
1181                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1182                next_offset += envelope_size;
1183            }
1184
1185            Ok(())
1186        }
1187    }
1188
1189    impl TimeSample {
1190        #[inline(always)]
1191        fn max_ordinal_present(&self) -> u64 {
1192            if let Some(_) = self.reference {
1193                return 4;
1194            }
1195            if let Some(_) = self.standard_deviation {
1196                return 3;
1197            }
1198            if let Some(_) = self.monotonic {
1199                return 2;
1200            }
1201            if let Some(_) = self.utc {
1202                return 1;
1203            }
1204            0
1205        }
1206    }
1207
1208    impl fidl::encoding::ValueTypeMarker for TimeSample {
1209        type Borrowed<'a> = &'a Self;
1210        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1211            value
1212        }
1213    }
1214
1215    unsafe impl fidl::encoding::TypeMarker for TimeSample {
1216        type Owned = Self;
1217
1218        #[inline(always)]
1219        fn inline_align(_context: fidl::encoding::Context) -> usize {
1220            8
1221        }
1222
1223        #[inline(always)]
1224        fn inline_size(_context: fidl::encoding::Context) -> usize {
1225            16
1226        }
1227    }
1228
1229    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TimeSample, D>
1230        for &TimeSample
1231    {
1232        unsafe fn encode(
1233            self,
1234            encoder: &mut fidl::encoding::Encoder<'_, D>,
1235            offset: usize,
1236            mut depth: fidl::encoding::Depth,
1237        ) -> fidl::Result<()> {
1238            encoder.debug_check_bounds::<TimeSample>(offset);
1239            // Vector header
1240            let max_ordinal: u64 = self.max_ordinal_present();
1241            encoder.write_num(max_ordinal, offset);
1242            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1243            // Calling encoder.out_of_line_offset(0) is not allowed.
1244            if max_ordinal == 0 {
1245                return Ok(());
1246            }
1247            depth.increment()?;
1248            let envelope_size = 8;
1249            let bytes_len = max_ordinal as usize * envelope_size;
1250            #[allow(unused_variables)]
1251            let offset = encoder.out_of_line_offset(bytes_len);
1252            let mut _prev_end_offset: usize = 0;
1253            if 1 > max_ordinal {
1254                return Ok(());
1255            }
1256
1257            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1258            // are envelope_size bytes.
1259            let cur_offset: usize = (1 - 1) * envelope_size;
1260
1261            // Zero reserved fields.
1262            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1263
1264            // Safety:
1265            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1266            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1267            //   envelope_size bytes, there is always sufficient room.
1268            fidl::encoding::encode_in_envelope_optional::<i64, D>(
1269                self.utc.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
1270                encoder,
1271                offset + cur_offset,
1272                depth,
1273            )?;
1274
1275            _prev_end_offset = cur_offset + envelope_size;
1276            if 2 > max_ordinal {
1277                return Ok(());
1278            }
1279
1280            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1281            // are envelope_size bytes.
1282            let cur_offset: usize = (2 - 1) * envelope_size;
1283
1284            // Zero reserved fields.
1285            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1286
1287            // Safety:
1288            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1289            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1290            //   envelope_size bytes, there is always sufficient room.
1291            fidl::encoding::encode_in_envelope_optional::<i64, D>(
1292                self.monotonic.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
1293                encoder,
1294                offset + cur_offset,
1295                depth,
1296            )?;
1297
1298            _prev_end_offset = cur_offset + envelope_size;
1299            if 3 > max_ordinal {
1300                return Ok(());
1301            }
1302
1303            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1304            // are envelope_size bytes.
1305            let cur_offset: usize = (3 - 1) * envelope_size;
1306
1307            // Zero reserved fields.
1308            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1309
1310            // Safety:
1311            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1312            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1313            //   envelope_size bytes, there is always sufficient room.
1314            fidl::encoding::encode_in_envelope_optional::<i64, D>(
1315                self.standard_deviation
1316                    .as_ref()
1317                    .map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
1318                encoder,
1319                offset + cur_offset,
1320                depth,
1321            )?;
1322
1323            _prev_end_offset = cur_offset + envelope_size;
1324            if 4 > max_ordinal {
1325                return Ok(());
1326            }
1327
1328            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1329            // are envelope_size bytes.
1330            let cur_offset: usize = (4 - 1) * envelope_size;
1331
1332            // Zero reserved fields.
1333            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1334
1335            // Safety:
1336            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1337            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1338            //   envelope_size bytes, there is always sufficient room.
1339            fidl::encoding::encode_in_envelope_optional::<fidl::BootInstant, D>(
1340                self.reference
1341                    .as_ref()
1342                    .map(<fidl::BootInstant as fidl::encoding::ValueTypeMarker>::borrow),
1343                encoder,
1344                offset + cur_offset,
1345                depth,
1346            )?;
1347
1348            _prev_end_offset = cur_offset + envelope_size;
1349
1350            Ok(())
1351        }
1352    }
1353
1354    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TimeSample {
1355        #[inline(always)]
1356        fn new_empty() -> Self {
1357            Self::default()
1358        }
1359
1360        unsafe fn decode(
1361            &mut self,
1362            decoder: &mut fidl::encoding::Decoder<'_, D>,
1363            offset: usize,
1364            mut depth: fidl::encoding::Depth,
1365        ) -> fidl::Result<()> {
1366            decoder.debug_check_bounds::<Self>(offset);
1367            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1368                None => return Err(fidl::Error::NotNullable),
1369                Some(len) => len,
1370            };
1371            // Calling decoder.out_of_line_offset(0) is not allowed.
1372            if len == 0 {
1373                return Ok(());
1374            };
1375            depth.increment()?;
1376            let envelope_size = 8;
1377            let bytes_len = len * envelope_size;
1378            let offset = decoder.out_of_line_offset(bytes_len)?;
1379            // Decode the envelope for each type.
1380            let mut _next_ordinal_to_read = 0;
1381            let mut next_offset = offset;
1382            let end_offset = offset + bytes_len;
1383            _next_ordinal_to_read += 1;
1384            if next_offset >= end_offset {
1385                return Ok(());
1386            }
1387
1388            // Decode unknown envelopes for gaps in ordinals.
1389            while _next_ordinal_to_read < 1 {
1390                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1391                _next_ordinal_to_read += 1;
1392                next_offset += envelope_size;
1393            }
1394
1395            let next_out_of_line = decoder.next_out_of_line();
1396            let handles_before = decoder.remaining_handles();
1397            if let Some((inlined, num_bytes, num_handles)) =
1398                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1399            {
1400                let member_inline_size =
1401                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1402                if inlined != (member_inline_size <= 4) {
1403                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1404                }
1405                let inner_offset;
1406                let mut inner_depth = depth.clone();
1407                if inlined {
1408                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1409                    inner_offset = next_offset;
1410                } else {
1411                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1412                    inner_depth.increment()?;
1413                }
1414                let val_ref = self.utc.get_or_insert_with(|| fidl::new_empty!(i64, D));
1415                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
1416                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1417                {
1418                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1419                }
1420                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1421                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1422                }
1423            }
1424
1425            next_offset += envelope_size;
1426            _next_ordinal_to_read += 1;
1427            if next_offset >= end_offset {
1428                return Ok(());
1429            }
1430
1431            // Decode unknown envelopes for gaps in ordinals.
1432            while _next_ordinal_to_read < 2 {
1433                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1434                _next_ordinal_to_read += 1;
1435                next_offset += envelope_size;
1436            }
1437
1438            let next_out_of_line = decoder.next_out_of_line();
1439            let handles_before = decoder.remaining_handles();
1440            if let Some((inlined, num_bytes, num_handles)) =
1441                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1442            {
1443                let member_inline_size =
1444                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1445                if inlined != (member_inline_size <= 4) {
1446                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1447                }
1448                let inner_offset;
1449                let mut inner_depth = depth.clone();
1450                if inlined {
1451                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1452                    inner_offset = next_offset;
1453                } else {
1454                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1455                    inner_depth.increment()?;
1456                }
1457                let val_ref = self.monotonic.get_or_insert_with(|| fidl::new_empty!(i64, D));
1458                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
1459                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1460                {
1461                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1462                }
1463                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1464                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1465                }
1466            }
1467
1468            next_offset += envelope_size;
1469            _next_ordinal_to_read += 1;
1470            if next_offset >= end_offset {
1471                return Ok(());
1472            }
1473
1474            // Decode unknown envelopes for gaps in ordinals.
1475            while _next_ordinal_to_read < 3 {
1476                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1477                _next_ordinal_to_read += 1;
1478                next_offset += envelope_size;
1479            }
1480
1481            let next_out_of_line = decoder.next_out_of_line();
1482            let handles_before = decoder.remaining_handles();
1483            if let Some((inlined, num_bytes, num_handles)) =
1484                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1485            {
1486                let member_inline_size =
1487                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1488                if inlined != (member_inline_size <= 4) {
1489                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1490                }
1491                let inner_offset;
1492                let mut inner_depth = depth.clone();
1493                if inlined {
1494                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1495                    inner_offset = next_offset;
1496                } else {
1497                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1498                    inner_depth.increment()?;
1499                }
1500                let val_ref =
1501                    self.standard_deviation.get_or_insert_with(|| fidl::new_empty!(i64, D));
1502                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
1503                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1504                {
1505                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1506                }
1507                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1508                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1509                }
1510            }
1511
1512            next_offset += envelope_size;
1513            _next_ordinal_to_read += 1;
1514            if next_offset >= end_offset {
1515                return Ok(());
1516            }
1517
1518            // Decode unknown envelopes for gaps in ordinals.
1519            while _next_ordinal_to_read < 4 {
1520                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1521                _next_ordinal_to_read += 1;
1522                next_offset += envelope_size;
1523            }
1524
1525            let next_out_of_line = decoder.next_out_of_line();
1526            let handles_before = decoder.remaining_handles();
1527            if let Some((inlined, num_bytes, num_handles)) =
1528                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1529            {
1530                let member_inline_size =
1531                    <fidl::BootInstant as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1532                if inlined != (member_inline_size <= 4) {
1533                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1534                }
1535                let inner_offset;
1536                let mut inner_depth = depth.clone();
1537                if inlined {
1538                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1539                    inner_offset = next_offset;
1540                } else {
1541                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1542                    inner_depth.increment()?;
1543                }
1544                let val_ref =
1545                    self.reference.get_or_insert_with(|| fidl::new_empty!(fidl::BootInstant, D));
1546                fidl::decode!(fidl::BootInstant, D, val_ref, decoder, inner_offset, inner_depth)?;
1547                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1548                {
1549                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1550                }
1551                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1552                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1553                }
1554            }
1555
1556            next_offset += envelope_size;
1557
1558            // Decode the remaining unknown envelopes.
1559            while next_offset < end_offset {
1560                _next_ordinal_to_read += 1;
1561                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1562                next_offset += envelope_size;
1563            }
1564
1565            Ok(())
1566        }
1567    }
1568}