fidl_fuchsia_tracing_controller_common/
fidl_fuchsia_tracing_controller_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/// aliases
12pub type AlertName = String;
13
14/// The maximum length of an alert name.
15pub const MAX_ALERT_NAME_LENGTH: u32 = 14;
16
17/// The maximum number of providers supported.
18pub const MAX_NUM_PROVIDERS: u32 = 100;
19
20/// The state of the tracing session.
21/// A "session" is everything between `Initialize` and `Terminate`.
22#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
23pub enum SessionState {
24    /// The tracing system is ready for a new session.
25    /// There can be only one session at a time.
26    Ready,
27    /// A new tracing session has been initialized.
28    Initialized,
29    /// Tracing is in the midst of starting.
30    Starting,
31    /// Tracing has started.
32    Started,
33    /// Tracing is in the midst of being stopped.
34    Stopping,
35    /// Tracing has fully stopped.
36    Stopped,
37    /// Tracing is in the midst of being terminated.
38    /// Once the system has completely terminated the session it goes back
39    /// to the READY state.
40    Terminating,
41    #[doc(hidden)]
42    __SourceBreaking { unknown_ordinal: u32 },
43}
44
45/// Pattern that matches an unknown `SessionState` member.
46#[macro_export]
47macro_rules! SessionStateUnknown {
48    () => {
49        _
50    };
51}
52
53impl SessionState {
54    #[inline]
55    pub fn from_primitive(prim: u32) -> Option<Self> {
56        match prim {
57            1 => Some(Self::Ready),
58            2 => Some(Self::Initialized),
59            3 => Some(Self::Starting),
60            4 => Some(Self::Started),
61            5 => Some(Self::Stopping),
62            6 => Some(Self::Stopped),
63            7 => Some(Self::Terminating),
64            _ => None,
65        }
66    }
67
68    #[inline]
69    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
70        match prim {
71            1 => Self::Ready,
72            2 => Self::Initialized,
73            3 => Self::Starting,
74            4 => Self::Started,
75            5 => Self::Stopping,
76            6 => Self::Stopped,
77            7 => Self::Terminating,
78            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
79        }
80    }
81
82    #[inline]
83    pub fn unknown() -> Self {
84        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
85    }
86
87    #[inline]
88    pub const fn into_primitive(self) -> u32 {
89        match self {
90            Self::Ready => 1,
91            Self::Initialized => 2,
92            Self::Starting => 3,
93            Self::Started => 4,
94            Self::Stopping => 5,
95            Self::Stopped => 6,
96            Self::Terminating => 7,
97            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
98        }
99    }
100
101    #[inline]
102    pub fn is_unknown(&self) -> bool {
103        match self {
104            Self::__SourceBreaking { unknown_ordinal: _ } => true,
105            _ => false,
106        }
107    }
108}
109
110/// Error codes from Start operations.
111#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
112pub enum StartError {
113    /// Tracing hasn't been initialized, not ready to start.
114    NotInitialized,
115    /// Tracing has already been started.
116    AlreadyStarted,
117    /// Tracing is currently being stopped.
118    Stopping,
119    /// Tracing is currently being terminated.
120    Terminating,
121    #[doc(hidden)]
122    __SourceBreaking { unknown_ordinal: u32 },
123}
124
125/// Pattern that matches an unknown `StartError` member.
126#[macro_export]
127macro_rules! StartErrorUnknown {
128    () => {
129        _
130    };
131}
132
133impl StartError {
134    #[inline]
135    pub fn from_primitive(prim: u32) -> Option<Self> {
136        match prim {
137            1 => Some(Self::NotInitialized),
138            2 => Some(Self::AlreadyStarted),
139            3 => Some(Self::Stopping),
140            4 => Some(Self::Terminating),
141            _ => None,
142        }
143    }
144
145    #[inline]
146    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
147        match prim {
148            1 => Self::NotInitialized,
149            2 => Self::AlreadyStarted,
150            3 => Self::Stopping,
151            4 => Self::Terminating,
152            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
153        }
154    }
155
156    #[inline]
157    pub fn unknown() -> Self {
158        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
159    }
160
161    #[inline]
162    pub const fn into_primitive(self) -> u32 {
163        match self {
164            Self::NotInitialized => 1,
165            Self::AlreadyStarted => 2,
166            Self::Stopping => 3,
167            Self::Terminating => 4,
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/// Error codes from Stop operations.
182#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
183pub enum StopError {
184    /// Trace controller is unavailable. Nothing to stop.
185    NotInitialized,
186    /// Tracing has not started or is currently stoppped.
187    NotStarted,
188    /// Tracing aborted due to error.
189    Aborted,
190    #[doc(hidden)]
191    __SourceBreaking { unknown_ordinal: u32 },
192}
193
194/// Pattern that matches an unknown `StopError` member.
195#[macro_export]
196macro_rules! StopErrorUnknown {
197    () => {
198        _
199    };
200}
201
202impl StopError {
203    #[inline]
204    pub fn from_primitive(prim: u32) -> Option<Self> {
205        match prim {
206            1 => Some(Self::NotInitialized),
207            2 => Some(Self::NotStarted),
208            3 => Some(Self::Aborted),
209            _ => None,
210        }
211    }
212
213    #[inline]
214    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
215        match prim {
216            1 => Self::NotInitialized,
217            2 => Self::NotStarted,
218            3 => Self::Aborted,
219            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
220        }
221    }
222
223    #[inline]
224    pub fn unknown() -> Self {
225        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
226    }
227
228    #[inline]
229    pub const fn into_primitive(self) -> u32 {
230        match self {
231            Self::NotInitialized => 1,
232            Self::NotStarted => 2,
233            Self::Aborted => 3,
234            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
235        }
236    }
237
238    #[inline]
239    pub fn is_unknown(&self) -> bool {
240        match self {
241            Self::__SourceBreaking { unknown_ordinal: _ } => true,
242            _ => false,
243        }
244    }
245}
246
247#[derive(Clone, Debug, PartialEq)]
248pub struct ProvisionerGetKnownCategoriesResponse {
249    pub categories: Vec<fidl_fuchsia_tracing::KnownCategory>,
250}
251
252impl fidl::Persistable for ProvisionerGetKnownCategoriesResponse {}
253
254#[derive(Clone, Debug, PartialEq)]
255pub struct ProvisionerGetProvidersResponse {
256    pub providers: Vec<ProviderInfo>,
257}
258
259impl fidl::Persistable for ProvisionerGetProvidersResponse {}
260
261#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
262pub struct SessionOnSessionStateChangeRequest {
263    pub state: SessionState,
264}
265
266impl fidl::Persistable for SessionOnSessionStateChangeRequest {}
267
268#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
269pub struct SessionWatchAlertResponse {
270    pub alert_name: String,
271}
272
273impl fidl::Persistable for SessionWatchAlertResponse {}
274
275/// Version of trace record format.
276///
277/// Default to the latest available version, which is currently 0.1.
278///
279/// More information about the format of trace records can be found here:
280/// https://fuchsia.dev/fuchsia-src/reference/tracing/trace-format
281#[derive(Clone, Debug, Default, PartialEq)]
282pub struct FxtVersion {
283    /// Defaults to 0.
284    pub major: Option<u32>,
285    /// Defaults to 1
286    pub minor: Option<u32>,
287    #[doc(hidden)]
288    pub __source_breaking: fidl::marker::SourceBreaking,
289}
290
291impl fidl::Persistable for FxtVersion {}
292
293/// Result of `GetProviders`.
294#[derive(Clone, Debug, Default, PartialEq)]
295pub struct ProviderInfo {
296    /// The provider's ID, assigned by trace-manager.
297    pub id: Option<u32>,
298    /// The provider's pid.
299    pub pid: Option<u64>,
300    /// The name of the provider.
301    pub name: Option<String>,
302    #[doc(hidden)]
303    pub __source_breaking: fidl::marker::SourceBreaking,
304}
305
306impl fidl::Persistable for ProviderInfo {}
307
308#[derive(Clone, Debug, Default, PartialEq)]
309pub struct ProviderSpec {
310    pub name: Option<String>,
311    pub buffer_size_megabytes_hint: Option<u32>,
312    pub categories: Option<Vec<String>>,
313    #[doc(hidden)]
314    pub __source_breaking: fidl::marker::SourceBreaking,
315}
316
317impl fidl::Persistable for ProviderSpec {}
318
319/// Statistics data per provider collected over the course of the tracing session
320#[derive(Clone, Debug, Default, PartialEq)]
321pub struct ProviderStats {
322    pub name: Option<String>,
323    pub pid: Option<u64>,
324    pub buffering_mode: Option<fidl_fuchsia_tracing::BufferingMode>,
325    pub buffer_wrapped_count: Option<u32>,
326    pub records_dropped: Option<u64>,
327    pub percentage_durable_buffer_used: Option<f32>,
328    pub non_durable_bytes_written: Option<u64>,
329    #[doc(hidden)]
330    pub __source_breaking: fidl::marker::SourceBreaking,
331}
332
333impl fidl::Persistable for ProviderStats {}
334
335/// Additional options to control trace data collection.
336#[derive(Clone, Debug, Default, PartialEq)]
337pub struct StartOptions {
338    /// Whether and how to clear the buffer when starting data collection.
339    /// This allows, for example, multiple Start/Stop trace runs to be
340    /// collected in the same buffer.
341    ///
342    /// If the preceding `Stop()` request had `save_after_stopped=true`
343    /// then this value is overridden to CLEAR_ENTIRE_BUFFER to avoid
344    /// duplicate data being saved.
345    pub buffer_disposition: Option<fidl_fuchsia_tracing::BufferDisposition>,
346    /// The trace categories to add to the initial set provided in
347    /// `TraceConfig`. If the combined number of categories goes over the
348    /// limit then the extra categories past the limit are discarded.
349    pub additional_categories: Option<Vec<String>>,
350    #[doc(hidden)]
351    pub __source_breaking: fidl::marker::SourceBreaking,
352}
353
354impl fidl::Persistable for StartOptions {}
355
356/// Additional options to control stopping of a trace.
357#[derive(Clone, Debug, Default, PartialEq)]
358pub struct StopOptions {
359    /// If true then write all collected data after tracing has stopped.
360    /// This is useful in situations where one wants to clear the buffer
361    /// before starting the next trace, without having to first terminate the
362    /// trace and start a new one.
363    pub write_results: Option<bool>,
364    #[doc(hidden)]
365    pub __source_breaking: fidl::marker::SourceBreaking,
366}
367
368impl fidl::Persistable for StopOptions {}
369
370/// Result of a terminate request.
371#[derive(Clone, Debug, Default, PartialEq)]
372pub struct StopResult {
373    pub provider_stats: Option<Vec<ProviderStats>>,
374    #[doc(hidden)]
375    pub __source_breaking: fidl::marker::SourceBreaking,
376}
377
378impl fidl::Persistable for StopResult {}
379
380/// Provides options for the trace.
381#[derive(Clone, Debug, Default, PartialEq)]
382pub struct TraceConfig {
383    /// The trace categories to record, or an empty array for all.
384    pub categories: Option<Vec<String>>,
385    /// Suggested size of trace buffer which each provider should receive.
386    pub buffer_size_megabytes_hint: Option<u32>,
387    /// Acknowledge start request after at most `start_timeout_milliseconds`.
388    pub start_timeout_milliseconds: Option<u64>,
389    pub buffering_mode: Option<fidl_fuchsia_tracing::BufferingMode>,
390    /// Overrides for particular providers.
391    pub provider_specs: Option<Vec<ProviderSpec>>,
392    /// Maximum trace format version supported byt the client.
393    /// If not set, this defaults to the latest available trace format version.
394    pub version: Option<FxtVersion>,
395    #[doc(hidden)]
396    pub __source_breaking: fidl::marker::SourceBreaking,
397}
398
399impl fidl::Persistable for TraceConfig {}
400
401mod internal {
402    use super::*;
403    unsafe impl fidl::encoding::TypeMarker for SessionState {
404        type Owned = Self;
405
406        #[inline(always)]
407        fn inline_align(_context: fidl::encoding::Context) -> usize {
408            std::mem::align_of::<u32>()
409        }
410
411        #[inline(always)]
412        fn inline_size(_context: fidl::encoding::Context) -> usize {
413            std::mem::size_of::<u32>()
414        }
415
416        #[inline(always)]
417        fn encode_is_copy() -> bool {
418            false
419        }
420
421        #[inline(always)]
422        fn decode_is_copy() -> bool {
423            false
424        }
425    }
426
427    impl fidl::encoding::ValueTypeMarker for SessionState {
428        type Borrowed<'a> = Self;
429        #[inline(always)]
430        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
431            *value
432        }
433    }
434
435    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for SessionState {
436        #[inline]
437        unsafe fn encode(
438            self,
439            encoder: &mut fidl::encoding::Encoder<'_, D>,
440            offset: usize,
441            _depth: fidl::encoding::Depth,
442        ) -> fidl::Result<()> {
443            encoder.debug_check_bounds::<Self>(offset);
444            encoder.write_num(self.into_primitive(), offset);
445            Ok(())
446        }
447    }
448
449    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SessionState {
450        #[inline(always)]
451        fn new_empty() -> Self {
452            Self::unknown()
453        }
454
455        #[inline]
456        unsafe fn decode(
457            &mut self,
458            decoder: &mut fidl::encoding::Decoder<'_, D>,
459            offset: usize,
460            _depth: fidl::encoding::Depth,
461        ) -> fidl::Result<()> {
462            decoder.debug_check_bounds::<Self>(offset);
463            let prim = decoder.read_num::<u32>(offset);
464
465            *self = Self::from_primitive_allow_unknown(prim);
466            Ok(())
467        }
468    }
469    unsafe impl fidl::encoding::TypeMarker for StartError {
470        type Owned = Self;
471
472        #[inline(always)]
473        fn inline_align(_context: fidl::encoding::Context) -> usize {
474            std::mem::align_of::<u32>()
475        }
476
477        #[inline(always)]
478        fn inline_size(_context: fidl::encoding::Context) -> usize {
479            std::mem::size_of::<u32>()
480        }
481
482        #[inline(always)]
483        fn encode_is_copy() -> bool {
484            false
485        }
486
487        #[inline(always)]
488        fn decode_is_copy() -> bool {
489            false
490        }
491    }
492
493    impl fidl::encoding::ValueTypeMarker for StartError {
494        type Borrowed<'a> = Self;
495        #[inline(always)]
496        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
497            *value
498        }
499    }
500
501    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for StartError {
502        #[inline]
503        unsafe fn encode(
504            self,
505            encoder: &mut fidl::encoding::Encoder<'_, D>,
506            offset: usize,
507            _depth: fidl::encoding::Depth,
508        ) -> fidl::Result<()> {
509            encoder.debug_check_bounds::<Self>(offset);
510            encoder.write_num(self.into_primitive(), offset);
511            Ok(())
512        }
513    }
514
515    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StartError {
516        #[inline(always)]
517        fn new_empty() -> Self {
518            Self::unknown()
519        }
520
521        #[inline]
522        unsafe fn decode(
523            &mut self,
524            decoder: &mut fidl::encoding::Decoder<'_, D>,
525            offset: usize,
526            _depth: fidl::encoding::Depth,
527        ) -> fidl::Result<()> {
528            decoder.debug_check_bounds::<Self>(offset);
529            let prim = decoder.read_num::<u32>(offset);
530
531            *self = Self::from_primitive_allow_unknown(prim);
532            Ok(())
533        }
534    }
535    unsafe impl fidl::encoding::TypeMarker for StopError {
536        type Owned = Self;
537
538        #[inline(always)]
539        fn inline_align(_context: fidl::encoding::Context) -> usize {
540            std::mem::align_of::<u32>()
541        }
542
543        #[inline(always)]
544        fn inline_size(_context: fidl::encoding::Context) -> usize {
545            std::mem::size_of::<u32>()
546        }
547
548        #[inline(always)]
549        fn encode_is_copy() -> bool {
550            false
551        }
552
553        #[inline(always)]
554        fn decode_is_copy() -> bool {
555            false
556        }
557    }
558
559    impl fidl::encoding::ValueTypeMarker for StopError {
560        type Borrowed<'a> = Self;
561        #[inline(always)]
562        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
563            *value
564        }
565    }
566
567    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for StopError {
568        #[inline]
569        unsafe fn encode(
570            self,
571            encoder: &mut fidl::encoding::Encoder<'_, D>,
572            offset: usize,
573            _depth: fidl::encoding::Depth,
574        ) -> fidl::Result<()> {
575            encoder.debug_check_bounds::<Self>(offset);
576            encoder.write_num(self.into_primitive(), offset);
577            Ok(())
578        }
579    }
580
581    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StopError {
582        #[inline(always)]
583        fn new_empty() -> Self {
584            Self::unknown()
585        }
586
587        #[inline]
588        unsafe fn decode(
589            &mut self,
590            decoder: &mut fidl::encoding::Decoder<'_, D>,
591            offset: usize,
592            _depth: fidl::encoding::Depth,
593        ) -> fidl::Result<()> {
594            decoder.debug_check_bounds::<Self>(offset);
595            let prim = decoder.read_num::<u32>(offset);
596
597            *self = Self::from_primitive_allow_unknown(prim);
598            Ok(())
599        }
600    }
601
602    impl fidl::encoding::ValueTypeMarker for ProvisionerGetKnownCategoriesResponse {
603        type Borrowed<'a> = &'a Self;
604        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
605            value
606        }
607    }
608
609    unsafe impl fidl::encoding::TypeMarker for ProvisionerGetKnownCategoriesResponse {
610        type Owned = Self;
611
612        #[inline(always)]
613        fn inline_align(_context: fidl::encoding::Context) -> usize {
614            8
615        }
616
617        #[inline(always)]
618        fn inline_size(_context: fidl::encoding::Context) -> usize {
619            16
620        }
621    }
622
623    unsafe impl<D: fidl::encoding::ResourceDialect>
624        fidl::encoding::Encode<ProvisionerGetKnownCategoriesResponse, D>
625        for &ProvisionerGetKnownCategoriesResponse
626    {
627        #[inline]
628        unsafe fn encode(
629            self,
630            encoder: &mut fidl::encoding::Encoder<'_, D>,
631            offset: usize,
632            _depth: fidl::encoding::Depth,
633        ) -> fidl::Result<()> {
634            encoder.debug_check_bounds::<ProvisionerGetKnownCategoriesResponse>(offset);
635            // Delegate to tuple encoding.
636            fidl::encoding::Encode::<ProvisionerGetKnownCategoriesResponse, D>::encode(
637                (
638                    <fidl::encoding::Vector<fidl_fuchsia_tracing::KnownCategory, 5000> as fidl::encoding::ValueTypeMarker>::borrow(&self.categories),
639                ),
640                encoder, offset, _depth
641            )
642        }
643    }
644    unsafe impl<
645            D: fidl::encoding::ResourceDialect,
646            T0: fidl::encoding::Encode<
647                fidl::encoding::Vector<fidl_fuchsia_tracing::KnownCategory, 5000>,
648                D,
649            >,
650        > fidl::encoding::Encode<ProvisionerGetKnownCategoriesResponse, D> for (T0,)
651    {
652        #[inline]
653        unsafe fn encode(
654            self,
655            encoder: &mut fidl::encoding::Encoder<'_, D>,
656            offset: usize,
657            depth: fidl::encoding::Depth,
658        ) -> fidl::Result<()> {
659            encoder.debug_check_bounds::<ProvisionerGetKnownCategoriesResponse>(offset);
660            // Zero out padding regions. There's no need to apply masks
661            // because the unmasked parts will be overwritten by fields.
662            // Write the fields.
663            self.0.encode(encoder, offset + 0, depth)?;
664            Ok(())
665        }
666    }
667
668    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
669        for ProvisionerGetKnownCategoriesResponse
670    {
671        #[inline(always)]
672        fn new_empty() -> Self {
673            Self {
674                categories: fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_tracing::KnownCategory, 5000>, D),
675            }
676        }
677
678        #[inline]
679        unsafe fn decode(
680            &mut self,
681            decoder: &mut fidl::encoding::Decoder<'_, D>,
682            offset: usize,
683            _depth: fidl::encoding::Depth,
684        ) -> fidl::Result<()> {
685            decoder.debug_check_bounds::<Self>(offset);
686            // Verify that padding bytes are zero.
687            fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_tracing::KnownCategory, 5000>, D, &mut self.categories, decoder, offset + 0, _depth)?;
688            Ok(())
689        }
690    }
691
692    impl fidl::encoding::ValueTypeMarker for ProvisionerGetProvidersResponse {
693        type Borrowed<'a> = &'a Self;
694        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
695            value
696        }
697    }
698
699    unsafe impl fidl::encoding::TypeMarker for ProvisionerGetProvidersResponse {
700        type Owned = Self;
701
702        #[inline(always)]
703        fn inline_align(_context: fidl::encoding::Context) -> usize {
704            8
705        }
706
707        #[inline(always)]
708        fn inline_size(_context: fidl::encoding::Context) -> usize {
709            16
710        }
711    }
712
713    unsafe impl<D: fidl::encoding::ResourceDialect>
714        fidl::encoding::Encode<ProvisionerGetProvidersResponse, D>
715        for &ProvisionerGetProvidersResponse
716    {
717        #[inline]
718        unsafe fn encode(
719            self,
720            encoder: &mut fidl::encoding::Encoder<'_, D>,
721            offset: usize,
722            _depth: fidl::encoding::Depth,
723        ) -> fidl::Result<()> {
724            encoder.debug_check_bounds::<ProvisionerGetProvidersResponse>(offset);
725            // Delegate to tuple encoding.
726            fidl::encoding::Encode::<ProvisionerGetProvidersResponse, D>::encode(
727                (
728                    <fidl::encoding::Vector<ProviderInfo, 100> as fidl::encoding::ValueTypeMarker>::borrow(&self.providers),
729                ),
730                encoder, offset, _depth
731            )
732        }
733    }
734    unsafe impl<
735            D: fidl::encoding::ResourceDialect,
736            T0: fidl::encoding::Encode<fidl::encoding::Vector<ProviderInfo, 100>, D>,
737        > fidl::encoding::Encode<ProvisionerGetProvidersResponse, D> for (T0,)
738    {
739        #[inline]
740        unsafe fn encode(
741            self,
742            encoder: &mut fidl::encoding::Encoder<'_, D>,
743            offset: usize,
744            depth: fidl::encoding::Depth,
745        ) -> fidl::Result<()> {
746            encoder.debug_check_bounds::<ProvisionerGetProvidersResponse>(offset);
747            // Zero out padding regions. There's no need to apply masks
748            // because the unmasked parts will be overwritten by fields.
749            // Write the fields.
750            self.0.encode(encoder, offset + 0, depth)?;
751            Ok(())
752        }
753    }
754
755    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
756        for ProvisionerGetProvidersResponse
757    {
758        #[inline(always)]
759        fn new_empty() -> Self {
760            Self { providers: fidl::new_empty!(fidl::encoding::Vector<ProviderInfo, 100>, D) }
761        }
762
763        #[inline]
764        unsafe fn decode(
765            &mut self,
766            decoder: &mut fidl::encoding::Decoder<'_, D>,
767            offset: usize,
768            _depth: fidl::encoding::Depth,
769        ) -> fidl::Result<()> {
770            decoder.debug_check_bounds::<Self>(offset);
771            // Verify that padding bytes are zero.
772            fidl::decode!(fidl::encoding::Vector<ProviderInfo, 100>, D, &mut self.providers, decoder, offset + 0, _depth)?;
773            Ok(())
774        }
775    }
776
777    impl fidl::encoding::ValueTypeMarker for SessionOnSessionStateChangeRequest {
778        type Borrowed<'a> = &'a Self;
779        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
780            value
781        }
782    }
783
784    unsafe impl fidl::encoding::TypeMarker for SessionOnSessionStateChangeRequest {
785        type Owned = Self;
786
787        #[inline(always)]
788        fn inline_align(_context: fidl::encoding::Context) -> usize {
789            4
790        }
791
792        #[inline(always)]
793        fn inline_size(_context: fidl::encoding::Context) -> usize {
794            4
795        }
796    }
797
798    unsafe impl<D: fidl::encoding::ResourceDialect>
799        fidl::encoding::Encode<SessionOnSessionStateChangeRequest, D>
800        for &SessionOnSessionStateChangeRequest
801    {
802        #[inline]
803        unsafe fn encode(
804            self,
805            encoder: &mut fidl::encoding::Encoder<'_, D>,
806            offset: usize,
807            _depth: fidl::encoding::Depth,
808        ) -> fidl::Result<()> {
809            encoder.debug_check_bounds::<SessionOnSessionStateChangeRequest>(offset);
810            // Delegate to tuple encoding.
811            fidl::encoding::Encode::<SessionOnSessionStateChangeRequest, D>::encode(
812                (<SessionState as fidl::encoding::ValueTypeMarker>::borrow(&self.state),),
813                encoder,
814                offset,
815                _depth,
816            )
817        }
818    }
819    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<SessionState, D>>
820        fidl::encoding::Encode<SessionOnSessionStateChangeRequest, D> for (T0,)
821    {
822        #[inline]
823        unsafe fn encode(
824            self,
825            encoder: &mut fidl::encoding::Encoder<'_, D>,
826            offset: usize,
827            depth: fidl::encoding::Depth,
828        ) -> fidl::Result<()> {
829            encoder.debug_check_bounds::<SessionOnSessionStateChangeRequest>(offset);
830            // Zero out padding regions. There's no need to apply masks
831            // because the unmasked parts will be overwritten by fields.
832            // Write the fields.
833            self.0.encode(encoder, offset + 0, depth)?;
834            Ok(())
835        }
836    }
837
838    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
839        for SessionOnSessionStateChangeRequest
840    {
841        #[inline(always)]
842        fn new_empty() -> Self {
843            Self { state: fidl::new_empty!(SessionState, D) }
844        }
845
846        #[inline]
847        unsafe fn decode(
848            &mut self,
849            decoder: &mut fidl::encoding::Decoder<'_, D>,
850            offset: usize,
851            _depth: fidl::encoding::Depth,
852        ) -> fidl::Result<()> {
853            decoder.debug_check_bounds::<Self>(offset);
854            // Verify that padding bytes are zero.
855            fidl::decode!(SessionState, D, &mut self.state, decoder, offset + 0, _depth)?;
856            Ok(())
857        }
858    }
859
860    impl fidl::encoding::ValueTypeMarker for SessionWatchAlertResponse {
861        type Borrowed<'a> = &'a Self;
862        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
863            value
864        }
865    }
866
867    unsafe impl fidl::encoding::TypeMarker for SessionWatchAlertResponse {
868        type Owned = Self;
869
870        #[inline(always)]
871        fn inline_align(_context: fidl::encoding::Context) -> usize {
872            8
873        }
874
875        #[inline(always)]
876        fn inline_size(_context: fidl::encoding::Context) -> usize {
877            16
878        }
879    }
880
881    unsafe impl<D: fidl::encoding::ResourceDialect>
882        fidl::encoding::Encode<SessionWatchAlertResponse, D> for &SessionWatchAlertResponse
883    {
884        #[inline]
885        unsafe fn encode(
886            self,
887            encoder: &mut fidl::encoding::Encoder<'_, D>,
888            offset: usize,
889            _depth: fidl::encoding::Depth,
890        ) -> fidl::Result<()> {
891            encoder.debug_check_bounds::<SessionWatchAlertResponse>(offset);
892            // Delegate to tuple encoding.
893            fidl::encoding::Encode::<SessionWatchAlertResponse, D>::encode(
894                (<fidl::encoding::BoundedString<14> as fidl::encoding::ValueTypeMarker>::borrow(
895                    &self.alert_name,
896                ),),
897                encoder,
898                offset,
899                _depth,
900            )
901        }
902    }
903    unsafe impl<
904            D: fidl::encoding::ResourceDialect,
905            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<14>, D>,
906        > fidl::encoding::Encode<SessionWatchAlertResponse, D> for (T0,)
907    {
908        #[inline]
909        unsafe fn encode(
910            self,
911            encoder: &mut fidl::encoding::Encoder<'_, D>,
912            offset: usize,
913            depth: fidl::encoding::Depth,
914        ) -> fidl::Result<()> {
915            encoder.debug_check_bounds::<SessionWatchAlertResponse>(offset);
916            // Zero out padding regions. There's no need to apply masks
917            // because the unmasked parts will be overwritten by fields.
918            // Write the fields.
919            self.0.encode(encoder, offset + 0, depth)?;
920            Ok(())
921        }
922    }
923
924    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
925        for SessionWatchAlertResponse
926    {
927        #[inline(always)]
928        fn new_empty() -> Self {
929            Self { alert_name: fidl::new_empty!(fidl::encoding::BoundedString<14>, D) }
930        }
931
932        #[inline]
933        unsafe fn decode(
934            &mut self,
935            decoder: &mut fidl::encoding::Decoder<'_, D>,
936            offset: usize,
937            _depth: fidl::encoding::Depth,
938        ) -> fidl::Result<()> {
939            decoder.debug_check_bounds::<Self>(offset);
940            // Verify that padding bytes are zero.
941            fidl::decode!(
942                fidl::encoding::BoundedString<14>,
943                D,
944                &mut self.alert_name,
945                decoder,
946                offset + 0,
947                _depth
948            )?;
949            Ok(())
950        }
951    }
952
953    impl FxtVersion {
954        #[inline(always)]
955        fn max_ordinal_present(&self) -> u64 {
956            if let Some(_) = self.minor {
957                return 2;
958            }
959            if let Some(_) = self.major {
960                return 1;
961            }
962            0
963        }
964    }
965
966    impl fidl::encoding::ValueTypeMarker for FxtVersion {
967        type Borrowed<'a> = &'a Self;
968        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
969            value
970        }
971    }
972
973    unsafe impl fidl::encoding::TypeMarker for FxtVersion {
974        type Owned = Self;
975
976        #[inline(always)]
977        fn inline_align(_context: fidl::encoding::Context) -> usize {
978            8
979        }
980
981        #[inline(always)]
982        fn inline_size(_context: fidl::encoding::Context) -> usize {
983            16
984        }
985    }
986
987    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FxtVersion, D>
988        for &FxtVersion
989    {
990        unsafe fn encode(
991            self,
992            encoder: &mut fidl::encoding::Encoder<'_, D>,
993            offset: usize,
994            mut depth: fidl::encoding::Depth,
995        ) -> fidl::Result<()> {
996            encoder.debug_check_bounds::<FxtVersion>(offset);
997            // Vector header
998            let max_ordinal: u64 = self.max_ordinal_present();
999            encoder.write_num(max_ordinal, offset);
1000            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1001            // Calling encoder.out_of_line_offset(0) is not allowed.
1002            if max_ordinal == 0 {
1003                return Ok(());
1004            }
1005            depth.increment()?;
1006            let envelope_size = 8;
1007            let bytes_len = max_ordinal as usize * envelope_size;
1008            #[allow(unused_variables)]
1009            let offset = encoder.out_of_line_offset(bytes_len);
1010            let mut _prev_end_offset: usize = 0;
1011            if 1 > max_ordinal {
1012                return Ok(());
1013            }
1014
1015            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1016            // are envelope_size bytes.
1017            let cur_offset: usize = (1 - 1) * envelope_size;
1018
1019            // Zero reserved fields.
1020            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1021
1022            // Safety:
1023            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1024            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1025            //   envelope_size bytes, there is always sufficient room.
1026            fidl::encoding::encode_in_envelope_optional::<u32, D>(
1027                self.major.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
1028                encoder,
1029                offset + cur_offset,
1030                depth,
1031            )?;
1032
1033            _prev_end_offset = cur_offset + envelope_size;
1034            if 2 > max_ordinal {
1035                return Ok(());
1036            }
1037
1038            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1039            // are envelope_size bytes.
1040            let cur_offset: usize = (2 - 1) * envelope_size;
1041
1042            // Zero reserved fields.
1043            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1044
1045            // Safety:
1046            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1047            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1048            //   envelope_size bytes, there is always sufficient room.
1049            fidl::encoding::encode_in_envelope_optional::<u32, D>(
1050                self.minor.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
1051                encoder,
1052                offset + cur_offset,
1053                depth,
1054            )?;
1055
1056            _prev_end_offset = cur_offset + envelope_size;
1057
1058            Ok(())
1059        }
1060    }
1061
1062    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FxtVersion {
1063        #[inline(always)]
1064        fn new_empty() -> Self {
1065            Self::default()
1066        }
1067
1068        unsafe fn decode(
1069            &mut self,
1070            decoder: &mut fidl::encoding::Decoder<'_, D>,
1071            offset: usize,
1072            mut depth: fidl::encoding::Depth,
1073        ) -> fidl::Result<()> {
1074            decoder.debug_check_bounds::<Self>(offset);
1075            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1076                None => return Err(fidl::Error::NotNullable),
1077                Some(len) => len,
1078            };
1079            // Calling decoder.out_of_line_offset(0) is not allowed.
1080            if len == 0 {
1081                return Ok(());
1082            };
1083            depth.increment()?;
1084            let envelope_size = 8;
1085            let bytes_len = len * envelope_size;
1086            let offset = decoder.out_of_line_offset(bytes_len)?;
1087            // Decode the envelope for each type.
1088            let mut _next_ordinal_to_read = 0;
1089            let mut next_offset = offset;
1090            let end_offset = offset + bytes_len;
1091            _next_ordinal_to_read += 1;
1092            if next_offset >= end_offset {
1093                return Ok(());
1094            }
1095
1096            // Decode unknown envelopes for gaps in ordinals.
1097            while _next_ordinal_to_read < 1 {
1098                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1099                _next_ordinal_to_read += 1;
1100                next_offset += envelope_size;
1101            }
1102
1103            let next_out_of_line = decoder.next_out_of_line();
1104            let handles_before = decoder.remaining_handles();
1105            if let Some((inlined, num_bytes, num_handles)) =
1106                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1107            {
1108                let member_inline_size =
1109                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1110                if inlined != (member_inline_size <= 4) {
1111                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1112                }
1113                let inner_offset;
1114                let mut inner_depth = depth.clone();
1115                if inlined {
1116                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1117                    inner_offset = next_offset;
1118                } else {
1119                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1120                    inner_depth.increment()?;
1121                }
1122                let val_ref = self.major.get_or_insert_with(|| fidl::new_empty!(u32, D));
1123                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
1124                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1125                {
1126                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1127                }
1128                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1129                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1130                }
1131            }
1132
1133            next_offset += envelope_size;
1134            _next_ordinal_to_read += 1;
1135            if next_offset >= end_offset {
1136                return Ok(());
1137            }
1138
1139            // Decode unknown envelopes for gaps in ordinals.
1140            while _next_ordinal_to_read < 2 {
1141                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1142                _next_ordinal_to_read += 1;
1143                next_offset += envelope_size;
1144            }
1145
1146            let next_out_of_line = decoder.next_out_of_line();
1147            let handles_before = decoder.remaining_handles();
1148            if let Some((inlined, num_bytes, num_handles)) =
1149                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1150            {
1151                let member_inline_size =
1152                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1153                if inlined != (member_inline_size <= 4) {
1154                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1155                }
1156                let inner_offset;
1157                let mut inner_depth = depth.clone();
1158                if inlined {
1159                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1160                    inner_offset = next_offset;
1161                } else {
1162                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1163                    inner_depth.increment()?;
1164                }
1165                let val_ref = self.minor.get_or_insert_with(|| fidl::new_empty!(u32, D));
1166                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
1167                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1168                {
1169                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1170                }
1171                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1172                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1173                }
1174            }
1175
1176            next_offset += envelope_size;
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 ProviderInfo {
1190        #[inline(always)]
1191        fn max_ordinal_present(&self) -> u64 {
1192            if let Some(_) = self.name {
1193                return 3;
1194            }
1195            if let Some(_) = self.pid {
1196                return 2;
1197            }
1198            if let Some(_) = self.id {
1199                return 1;
1200            }
1201            0
1202        }
1203    }
1204
1205    impl fidl::encoding::ValueTypeMarker for ProviderInfo {
1206        type Borrowed<'a> = &'a Self;
1207        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1208            value
1209        }
1210    }
1211
1212    unsafe impl fidl::encoding::TypeMarker for ProviderInfo {
1213        type Owned = Self;
1214
1215        #[inline(always)]
1216        fn inline_align(_context: fidl::encoding::Context) -> usize {
1217            8
1218        }
1219
1220        #[inline(always)]
1221        fn inline_size(_context: fidl::encoding::Context) -> usize {
1222            16
1223        }
1224    }
1225
1226    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ProviderInfo, D>
1227        for &ProviderInfo
1228    {
1229        unsafe fn encode(
1230            self,
1231            encoder: &mut fidl::encoding::Encoder<'_, D>,
1232            offset: usize,
1233            mut depth: fidl::encoding::Depth,
1234        ) -> fidl::Result<()> {
1235            encoder.debug_check_bounds::<ProviderInfo>(offset);
1236            // Vector header
1237            let max_ordinal: u64 = self.max_ordinal_present();
1238            encoder.write_num(max_ordinal, offset);
1239            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1240            // Calling encoder.out_of_line_offset(0) is not allowed.
1241            if max_ordinal == 0 {
1242                return Ok(());
1243            }
1244            depth.increment()?;
1245            let envelope_size = 8;
1246            let bytes_len = max_ordinal as usize * envelope_size;
1247            #[allow(unused_variables)]
1248            let offset = encoder.out_of_line_offset(bytes_len);
1249            let mut _prev_end_offset: usize = 0;
1250            if 1 > max_ordinal {
1251                return Ok(());
1252            }
1253
1254            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1255            // are envelope_size bytes.
1256            let cur_offset: usize = (1 - 1) * envelope_size;
1257
1258            // Zero reserved fields.
1259            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1260
1261            // Safety:
1262            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1263            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1264            //   envelope_size bytes, there is always sufficient room.
1265            fidl::encoding::encode_in_envelope_optional::<u32, D>(
1266                self.id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
1267                encoder,
1268                offset + cur_offset,
1269                depth,
1270            )?;
1271
1272            _prev_end_offset = cur_offset + envelope_size;
1273            if 2 > max_ordinal {
1274                return Ok(());
1275            }
1276
1277            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1278            // are envelope_size bytes.
1279            let cur_offset: usize = (2 - 1) * envelope_size;
1280
1281            // Zero reserved fields.
1282            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1283
1284            // Safety:
1285            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1286            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1287            //   envelope_size bytes, there is always sufficient room.
1288            fidl::encoding::encode_in_envelope_optional::<u64, D>(
1289                self.pid.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
1290                encoder,
1291                offset + cur_offset,
1292                depth,
1293            )?;
1294
1295            _prev_end_offset = cur_offset + envelope_size;
1296            if 3 > max_ordinal {
1297                return Ok(());
1298            }
1299
1300            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1301            // are envelope_size bytes.
1302            let cur_offset: usize = (3 - 1) * envelope_size;
1303
1304            // Zero reserved fields.
1305            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1306
1307            // Safety:
1308            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1309            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1310            //   envelope_size bytes, there is always sufficient room.
1311            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<100>, D>(
1312                self.name.as_ref().map(
1313                    <fidl::encoding::BoundedString<100> as fidl::encoding::ValueTypeMarker>::borrow,
1314                ),
1315                encoder,
1316                offset + cur_offset,
1317                depth,
1318            )?;
1319
1320            _prev_end_offset = cur_offset + envelope_size;
1321
1322            Ok(())
1323        }
1324    }
1325
1326    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ProviderInfo {
1327        #[inline(always)]
1328        fn new_empty() -> Self {
1329            Self::default()
1330        }
1331
1332        unsafe fn decode(
1333            &mut self,
1334            decoder: &mut fidl::encoding::Decoder<'_, D>,
1335            offset: usize,
1336            mut depth: fidl::encoding::Depth,
1337        ) -> fidl::Result<()> {
1338            decoder.debug_check_bounds::<Self>(offset);
1339            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1340                None => return Err(fidl::Error::NotNullable),
1341                Some(len) => len,
1342            };
1343            // Calling decoder.out_of_line_offset(0) is not allowed.
1344            if len == 0 {
1345                return Ok(());
1346            };
1347            depth.increment()?;
1348            let envelope_size = 8;
1349            let bytes_len = len * envelope_size;
1350            let offset = decoder.out_of_line_offset(bytes_len)?;
1351            // Decode the envelope for each type.
1352            let mut _next_ordinal_to_read = 0;
1353            let mut next_offset = offset;
1354            let end_offset = offset + bytes_len;
1355            _next_ordinal_to_read += 1;
1356            if next_offset >= end_offset {
1357                return Ok(());
1358            }
1359
1360            // Decode unknown envelopes for gaps in ordinals.
1361            while _next_ordinal_to_read < 1 {
1362                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1363                _next_ordinal_to_read += 1;
1364                next_offset += envelope_size;
1365            }
1366
1367            let next_out_of_line = decoder.next_out_of_line();
1368            let handles_before = decoder.remaining_handles();
1369            if let Some((inlined, num_bytes, num_handles)) =
1370                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1371            {
1372                let member_inline_size =
1373                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1374                if inlined != (member_inline_size <= 4) {
1375                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1376                }
1377                let inner_offset;
1378                let mut inner_depth = depth.clone();
1379                if inlined {
1380                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1381                    inner_offset = next_offset;
1382                } else {
1383                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1384                    inner_depth.increment()?;
1385                }
1386                let val_ref = self.id.get_or_insert_with(|| fidl::new_empty!(u32, D));
1387                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
1388                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1389                {
1390                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1391                }
1392                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1393                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1394                }
1395            }
1396
1397            next_offset += envelope_size;
1398            _next_ordinal_to_read += 1;
1399            if next_offset >= end_offset {
1400                return Ok(());
1401            }
1402
1403            // Decode unknown envelopes for gaps in ordinals.
1404            while _next_ordinal_to_read < 2 {
1405                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1406                _next_ordinal_to_read += 1;
1407                next_offset += envelope_size;
1408            }
1409
1410            let next_out_of_line = decoder.next_out_of_line();
1411            let handles_before = decoder.remaining_handles();
1412            if let Some((inlined, num_bytes, num_handles)) =
1413                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1414            {
1415                let member_inline_size =
1416                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1417                if inlined != (member_inline_size <= 4) {
1418                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1419                }
1420                let inner_offset;
1421                let mut inner_depth = depth.clone();
1422                if inlined {
1423                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1424                    inner_offset = next_offset;
1425                } else {
1426                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1427                    inner_depth.increment()?;
1428                }
1429                let val_ref = self.pid.get_or_insert_with(|| fidl::new_empty!(u64, D));
1430                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
1431                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1432                {
1433                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1434                }
1435                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1436                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1437                }
1438            }
1439
1440            next_offset += envelope_size;
1441            _next_ordinal_to_read += 1;
1442            if next_offset >= end_offset {
1443                return Ok(());
1444            }
1445
1446            // Decode unknown envelopes for gaps in ordinals.
1447            while _next_ordinal_to_read < 3 {
1448                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1449                _next_ordinal_to_read += 1;
1450                next_offset += envelope_size;
1451            }
1452
1453            let next_out_of_line = decoder.next_out_of_line();
1454            let handles_before = decoder.remaining_handles();
1455            if let Some((inlined, num_bytes, num_handles)) =
1456                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1457            {
1458                let member_inline_size =
1459                    <fidl::encoding::BoundedString<100> as fidl::encoding::TypeMarker>::inline_size(
1460                        decoder.context,
1461                    );
1462                if inlined != (member_inline_size <= 4) {
1463                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1464                }
1465                let inner_offset;
1466                let mut inner_depth = depth.clone();
1467                if inlined {
1468                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1469                    inner_offset = next_offset;
1470                } else {
1471                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1472                    inner_depth.increment()?;
1473                }
1474                let val_ref = self
1475                    .name
1476                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<100>, D));
1477                fidl::decode!(
1478                    fidl::encoding::BoundedString<100>,
1479                    D,
1480                    val_ref,
1481                    decoder,
1482                    inner_offset,
1483                    inner_depth
1484                )?;
1485                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1486                {
1487                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1488                }
1489                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1490                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1491                }
1492            }
1493
1494            next_offset += envelope_size;
1495
1496            // Decode the remaining unknown envelopes.
1497            while next_offset < end_offset {
1498                _next_ordinal_to_read += 1;
1499                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1500                next_offset += envelope_size;
1501            }
1502
1503            Ok(())
1504        }
1505    }
1506
1507    impl ProviderSpec {
1508        #[inline(always)]
1509        fn max_ordinal_present(&self) -> u64 {
1510            if let Some(_) = self.categories {
1511                return 3;
1512            }
1513            if let Some(_) = self.buffer_size_megabytes_hint {
1514                return 2;
1515            }
1516            if let Some(_) = self.name {
1517                return 1;
1518            }
1519            0
1520        }
1521    }
1522
1523    impl fidl::encoding::ValueTypeMarker for ProviderSpec {
1524        type Borrowed<'a> = &'a Self;
1525        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1526            value
1527        }
1528    }
1529
1530    unsafe impl fidl::encoding::TypeMarker for ProviderSpec {
1531        type Owned = Self;
1532
1533        #[inline(always)]
1534        fn inline_align(_context: fidl::encoding::Context) -> usize {
1535            8
1536        }
1537
1538        #[inline(always)]
1539        fn inline_size(_context: fidl::encoding::Context) -> usize {
1540            16
1541        }
1542    }
1543
1544    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ProviderSpec, D>
1545        for &ProviderSpec
1546    {
1547        unsafe fn encode(
1548            self,
1549            encoder: &mut fidl::encoding::Encoder<'_, D>,
1550            offset: usize,
1551            mut depth: fidl::encoding::Depth,
1552        ) -> fidl::Result<()> {
1553            encoder.debug_check_bounds::<ProviderSpec>(offset);
1554            // Vector header
1555            let max_ordinal: u64 = self.max_ordinal_present();
1556            encoder.write_num(max_ordinal, offset);
1557            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1558            // Calling encoder.out_of_line_offset(0) is not allowed.
1559            if max_ordinal == 0 {
1560                return Ok(());
1561            }
1562            depth.increment()?;
1563            let envelope_size = 8;
1564            let bytes_len = max_ordinal as usize * envelope_size;
1565            #[allow(unused_variables)]
1566            let offset = encoder.out_of_line_offset(bytes_len);
1567            let mut _prev_end_offset: usize = 0;
1568            if 1 > max_ordinal {
1569                return Ok(());
1570            }
1571
1572            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1573            // are envelope_size bytes.
1574            let cur_offset: usize = (1 - 1) * envelope_size;
1575
1576            // Zero reserved fields.
1577            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1578
1579            // Safety:
1580            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1581            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1582            //   envelope_size bytes, there is always sufficient room.
1583            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<100>, D>(
1584                self.name.as_ref().map(
1585                    <fidl::encoding::BoundedString<100> as fidl::encoding::ValueTypeMarker>::borrow,
1586                ),
1587                encoder,
1588                offset + cur_offset,
1589                depth,
1590            )?;
1591
1592            _prev_end_offset = cur_offset + envelope_size;
1593            if 2 > max_ordinal {
1594                return Ok(());
1595            }
1596
1597            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1598            // are envelope_size bytes.
1599            let cur_offset: usize = (2 - 1) * envelope_size;
1600
1601            // Zero reserved fields.
1602            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1603
1604            // Safety:
1605            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1606            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1607            //   envelope_size bytes, there is always sufficient room.
1608            fidl::encoding::encode_in_envelope_optional::<u32, D>(
1609                self.buffer_size_megabytes_hint
1610                    .as_ref()
1611                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
1612                encoder,
1613                offset + cur_offset,
1614                depth,
1615            )?;
1616
1617            _prev_end_offset = cur_offset + envelope_size;
1618            if 3 > max_ordinal {
1619                return Ok(());
1620            }
1621
1622            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1623            // are envelope_size bytes.
1624            let cur_offset: usize = (3 - 1) * envelope_size;
1625
1626            // Zero reserved fields.
1627            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1628
1629            // Safety:
1630            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1631            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1632            //   envelope_size bytes, there is always sufficient room.
1633            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 5000>, D>(
1634            self.categories.as_ref().map(<fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 5000> as fidl::encoding::ValueTypeMarker>::borrow),
1635            encoder, offset + cur_offset, depth
1636        )?;
1637
1638            _prev_end_offset = cur_offset + envelope_size;
1639
1640            Ok(())
1641        }
1642    }
1643
1644    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ProviderSpec {
1645        #[inline(always)]
1646        fn new_empty() -> Self {
1647            Self::default()
1648        }
1649
1650        unsafe fn decode(
1651            &mut self,
1652            decoder: &mut fidl::encoding::Decoder<'_, D>,
1653            offset: usize,
1654            mut depth: fidl::encoding::Depth,
1655        ) -> fidl::Result<()> {
1656            decoder.debug_check_bounds::<Self>(offset);
1657            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1658                None => return Err(fidl::Error::NotNullable),
1659                Some(len) => len,
1660            };
1661            // Calling decoder.out_of_line_offset(0) is not allowed.
1662            if len == 0 {
1663                return Ok(());
1664            };
1665            depth.increment()?;
1666            let envelope_size = 8;
1667            let bytes_len = len * envelope_size;
1668            let offset = decoder.out_of_line_offset(bytes_len)?;
1669            // Decode the envelope for each type.
1670            let mut _next_ordinal_to_read = 0;
1671            let mut next_offset = offset;
1672            let end_offset = offset + bytes_len;
1673            _next_ordinal_to_read += 1;
1674            if next_offset >= end_offset {
1675                return Ok(());
1676            }
1677
1678            // Decode unknown envelopes for gaps in ordinals.
1679            while _next_ordinal_to_read < 1 {
1680                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1681                _next_ordinal_to_read += 1;
1682                next_offset += envelope_size;
1683            }
1684
1685            let next_out_of_line = decoder.next_out_of_line();
1686            let handles_before = decoder.remaining_handles();
1687            if let Some((inlined, num_bytes, num_handles)) =
1688                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1689            {
1690                let member_inline_size =
1691                    <fidl::encoding::BoundedString<100> as fidl::encoding::TypeMarker>::inline_size(
1692                        decoder.context,
1693                    );
1694                if inlined != (member_inline_size <= 4) {
1695                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1696                }
1697                let inner_offset;
1698                let mut inner_depth = depth.clone();
1699                if inlined {
1700                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1701                    inner_offset = next_offset;
1702                } else {
1703                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1704                    inner_depth.increment()?;
1705                }
1706                let val_ref = self
1707                    .name
1708                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<100>, D));
1709                fidl::decode!(
1710                    fidl::encoding::BoundedString<100>,
1711                    D,
1712                    val_ref,
1713                    decoder,
1714                    inner_offset,
1715                    inner_depth
1716                )?;
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 < 2 {
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                    <u32 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 =
1759                    self.buffer_size_megabytes_hint.get_or_insert_with(|| fidl::new_empty!(u32, D));
1760                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
1761                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1762                {
1763                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1764                }
1765                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1766                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1767                }
1768            }
1769
1770            next_offset += envelope_size;
1771            _next_ordinal_to_read += 1;
1772            if next_offset >= end_offset {
1773                return Ok(());
1774            }
1775
1776            // Decode unknown envelopes for gaps in ordinals.
1777            while _next_ordinal_to_read < 3 {
1778                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1779                _next_ordinal_to_read += 1;
1780                next_offset += envelope_size;
1781            }
1782
1783            let next_out_of_line = decoder.next_out_of_line();
1784            let handles_before = decoder.remaining_handles();
1785            if let Some((inlined, num_bytes, num_handles)) =
1786                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1787            {
1788                let member_inline_size = <fidl::encoding::Vector<
1789                    fidl::encoding::BoundedString<100>,
1790                    5000,
1791                > as fidl::encoding::TypeMarker>::inline_size(
1792                    decoder.context
1793                );
1794                if inlined != (member_inline_size <= 4) {
1795                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1796                }
1797                let inner_offset;
1798                let mut inner_depth = depth.clone();
1799                if inlined {
1800                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1801                    inner_offset = next_offset;
1802                } else {
1803                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1804                    inner_depth.increment()?;
1805                }
1806                let val_ref = self.categories.get_or_insert_with(|| {
1807                    fidl::new_empty!(
1808                        fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 5000>,
1809                        D
1810                    )
1811                });
1812                fidl::decode!(
1813                    fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 5000>,
1814                    D,
1815                    val_ref,
1816                    decoder,
1817                    inner_offset,
1818                    inner_depth
1819                )?;
1820                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1821                {
1822                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1823                }
1824                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1825                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1826                }
1827            }
1828
1829            next_offset += envelope_size;
1830
1831            // Decode the remaining unknown envelopes.
1832            while next_offset < end_offset {
1833                _next_ordinal_to_read += 1;
1834                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1835                next_offset += envelope_size;
1836            }
1837
1838            Ok(())
1839        }
1840    }
1841
1842    impl ProviderStats {
1843        #[inline(always)]
1844        fn max_ordinal_present(&self) -> u64 {
1845            if let Some(_) = self.non_durable_bytes_written {
1846                return 7;
1847            }
1848            if let Some(_) = self.percentage_durable_buffer_used {
1849                return 6;
1850            }
1851            if let Some(_) = self.records_dropped {
1852                return 5;
1853            }
1854            if let Some(_) = self.buffer_wrapped_count {
1855                return 4;
1856            }
1857            if let Some(_) = self.buffering_mode {
1858                return 3;
1859            }
1860            if let Some(_) = self.pid {
1861                return 2;
1862            }
1863            if let Some(_) = self.name {
1864                return 1;
1865            }
1866            0
1867        }
1868    }
1869
1870    impl fidl::encoding::ValueTypeMarker for ProviderStats {
1871        type Borrowed<'a> = &'a Self;
1872        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1873            value
1874        }
1875    }
1876
1877    unsafe impl fidl::encoding::TypeMarker for ProviderStats {
1878        type Owned = Self;
1879
1880        #[inline(always)]
1881        fn inline_align(_context: fidl::encoding::Context) -> usize {
1882            8
1883        }
1884
1885        #[inline(always)]
1886        fn inline_size(_context: fidl::encoding::Context) -> usize {
1887            16
1888        }
1889    }
1890
1891    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ProviderStats, D>
1892        for &ProviderStats
1893    {
1894        unsafe fn encode(
1895            self,
1896            encoder: &mut fidl::encoding::Encoder<'_, D>,
1897            offset: usize,
1898            mut depth: fidl::encoding::Depth,
1899        ) -> fidl::Result<()> {
1900            encoder.debug_check_bounds::<ProviderStats>(offset);
1901            // Vector header
1902            let max_ordinal: u64 = self.max_ordinal_present();
1903            encoder.write_num(max_ordinal, offset);
1904            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1905            // Calling encoder.out_of_line_offset(0) is not allowed.
1906            if max_ordinal == 0 {
1907                return Ok(());
1908            }
1909            depth.increment()?;
1910            let envelope_size = 8;
1911            let bytes_len = max_ordinal as usize * envelope_size;
1912            #[allow(unused_variables)]
1913            let offset = encoder.out_of_line_offset(bytes_len);
1914            let mut _prev_end_offset: usize = 0;
1915            if 1 > max_ordinal {
1916                return Ok(());
1917            }
1918
1919            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1920            // are envelope_size bytes.
1921            let cur_offset: usize = (1 - 1) * envelope_size;
1922
1923            // Zero reserved fields.
1924            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1925
1926            // Safety:
1927            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1928            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1929            //   envelope_size bytes, there is always sufficient room.
1930            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<100>, D>(
1931                self.name.as_ref().map(
1932                    <fidl::encoding::BoundedString<100> as fidl::encoding::ValueTypeMarker>::borrow,
1933                ),
1934                encoder,
1935                offset + cur_offset,
1936                depth,
1937            )?;
1938
1939            _prev_end_offset = cur_offset + envelope_size;
1940            if 2 > max_ordinal {
1941                return Ok(());
1942            }
1943
1944            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1945            // are envelope_size bytes.
1946            let cur_offset: usize = (2 - 1) * envelope_size;
1947
1948            // Zero reserved fields.
1949            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1950
1951            // Safety:
1952            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1953            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1954            //   envelope_size bytes, there is always sufficient room.
1955            fidl::encoding::encode_in_envelope_optional::<u64, D>(
1956                self.pid.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
1957                encoder,
1958                offset + cur_offset,
1959                depth,
1960            )?;
1961
1962            _prev_end_offset = cur_offset + envelope_size;
1963            if 3 > max_ordinal {
1964                return Ok(());
1965            }
1966
1967            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1968            // are envelope_size bytes.
1969            let cur_offset: usize = (3 - 1) * envelope_size;
1970
1971            // Zero reserved fields.
1972            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1973
1974            // Safety:
1975            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1976            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1977            //   envelope_size bytes, there is always sufficient room.
1978            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_tracing::BufferingMode, D>(
1979            self.buffering_mode.as_ref().map(<fidl_fuchsia_tracing::BufferingMode as fidl::encoding::ValueTypeMarker>::borrow),
1980            encoder, offset + cur_offset, depth
1981        )?;
1982
1983            _prev_end_offset = cur_offset + envelope_size;
1984            if 4 > max_ordinal {
1985                return Ok(());
1986            }
1987
1988            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1989            // are envelope_size bytes.
1990            let cur_offset: usize = (4 - 1) * envelope_size;
1991
1992            // Zero reserved fields.
1993            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1994
1995            // Safety:
1996            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1997            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1998            //   envelope_size bytes, there is always sufficient room.
1999            fidl::encoding::encode_in_envelope_optional::<u32, D>(
2000                self.buffer_wrapped_count
2001                    .as_ref()
2002                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
2003                encoder,
2004                offset + cur_offset,
2005                depth,
2006            )?;
2007
2008            _prev_end_offset = cur_offset + envelope_size;
2009            if 5 > max_ordinal {
2010                return Ok(());
2011            }
2012
2013            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2014            // are envelope_size bytes.
2015            let cur_offset: usize = (5 - 1) * envelope_size;
2016
2017            // Zero reserved fields.
2018            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2019
2020            // Safety:
2021            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2022            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2023            //   envelope_size bytes, there is always sufficient room.
2024            fidl::encoding::encode_in_envelope_optional::<u64, D>(
2025                self.records_dropped.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2026                encoder,
2027                offset + cur_offset,
2028                depth,
2029            )?;
2030
2031            _prev_end_offset = cur_offset + envelope_size;
2032            if 6 > max_ordinal {
2033                return Ok(());
2034            }
2035
2036            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2037            // are envelope_size bytes.
2038            let cur_offset: usize = (6 - 1) * envelope_size;
2039
2040            // Zero reserved fields.
2041            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2042
2043            // Safety:
2044            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2045            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2046            //   envelope_size bytes, there is always sufficient room.
2047            fidl::encoding::encode_in_envelope_optional::<f32, D>(
2048                self.percentage_durable_buffer_used
2049                    .as_ref()
2050                    .map(<f32 as fidl::encoding::ValueTypeMarker>::borrow),
2051                encoder,
2052                offset + cur_offset,
2053                depth,
2054            )?;
2055
2056            _prev_end_offset = cur_offset + envelope_size;
2057            if 7 > max_ordinal {
2058                return Ok(());
2059            }
2060
2061            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2062            // are envelope_size bytes.
2063            let cur_offset: usize = (7 - 1) * envelope_size;
2064
2065            // Zero reserved fields.
2066            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2067
2068            // Safety:
2069            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2070            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2071            //   envelope_size bytes, there is always sufficient room.
2072            fidl::encoding::encode_in_envelope_optional::<u64, D>(
2073                self.non_durable_bytes_written
2074                    .as_ref()
2075                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2076                encoder,
2077                offset + cur_offset,
2078                depth,
2079            )?;
2080
2081            _prev_end_offset = cur_offset + envelope_size;
2082
2083            Ok(())
2084        }
2085    }
2086
2087    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ProviderStats {
2088        #[inline(always)]
2089        fn new_empty() -> Self {
2090            Self::default()
2091        }
2092
2093        unsafe fn decode(
2094            &mut self,
2095            decoder: &mut fidl::encoding::Decoder<'_, D>,
2096            offset: usize,
2097            mut depth: fidl::encoding::Depth,
2098        ) -> fidl::Result<()> {
2099            decoder.debug_check_bounds::<Self>(offset);
2100            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2101                None => return Err(fidl::Error::NotNullable),
2102                Some(len) => len,
2103            };
2104            // Calling decoder.out_of_line_offset(0) is not allowed.
2105            if len == 0 {
2106                return Ok(());
2107            };
2108            depth.increment()?;
2109            let envelope_size = 8;
2110            let bytes_len = len * envelope_size;
2111            let offset = decoder.out_of_line_offset(bytes_len)?;
2112            // Decode the envelope for each type.
2113            let mut _next_ordinal_to_read = 0;
2114            let mut next_offset = offset;
2115            let end_offset = offset + bytes_len;
2116            _next_ordinal_to_read += 1;
2117            if next_offset >= end_offset {
2118                return Ok(());
2119            }
2120
2121            // Decode unknown envelopes for gaps in ordinals.
2122            while _next_ordinal_to_read < 1 {
2123                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2124                _next_ordinal_to_read += 1;
2125                next_offset += envelope_size;
2126            }
2127
2128            let next_out_of_line = decoder.next_out_of_line();
2129            let handles_before = decoder.remaining_handles();
2130            if let Some((inlined, num_bytes, num_handles)) =
2131                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2132            {
2133                let member_inline_size =
2134                    <fidl::encoding::BoundedString<100> as fidl::encoding::TypeMarker>::inline_size(
2135                        decoder.context,
2136                    );
2137                if inlined != (member_inline_size <= 4) {
2138                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2139                }
2140                let inner_offset;
2141                let mut inner_depth = depth.clone();
2142                if inlined {
2143                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2144                    inner_offset = next_offset;
2145                } else {
2146                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2147                    inner_depth.increment()?;
2148                }
2149                let val_ref = self
2150                    .name
2151                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<100>, D));
2152                fidl::decode!(
2153                    fidl::encoding::BoundedString<100>,
2154                    D,
2155                    val_ref,
2156                    decoder,
2157                    inner_offset,
2158                    inner_depth
2159                )?;
2160                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2161                {
2162                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2163                }
2164                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2165                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2166                }
2167            }
2168
2169            next_offset += envelope_size;
2170            _next_ordinal_to_read += 1;
2171            if next_offset >= end_offset {
2172                return Ok(());
2173            }
2174
2175            // Decode unknown envelopes for gaps in ordinals.
2176            while _next_ordinal_to_read < 2 {
2177                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2178                _next_ordinal_to_read += 1;
2179                next_offset += envelope_size;
2180            }
2181
2182            let next_out_of_line = decoder.next_out_of_line();
2183            let handles_before = decoder.remaining_handles();
2184            if let Some((inlined, num_bytes, num_handles)) =
2185                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2186            {
2187                let member_inline_size =
2188                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2189                if inlined != (member_inline_size <= 4) {
2190                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2191                }
2192                let inner_offset;
2193                let mut inner_depth = depth.clone();
2194                if inlined {
2195                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2196                    inner_offset = next_offset;
2197                } else {
2198                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2199                    inner_depth.increment()?;
2200                }
2201                let val_ref = self.pid.get_or_insert_with(|| fidl::new_empty!(u64, D));
2202                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
2203                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2204                {
2205                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2206                }
2207                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2208                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2209                }
2210            }
2211
2212            next_offset += envelope_size;
2213            _next_ordinal_to_read += 1;
2214            if next_offset >= end_offset {
2215                return Ok(());
2216            }
2217
2218            // Decode unknown envelopes for gaps in ordinals.
2219            while _next_ordinal_to_read < 3 {
2220                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2221                _next_ordinal_to_read += 1;
2222                next_offset += envelope_size;
2223            }
2224
2225            let next_out_of_line = decoder.next_out_of_line();
2226            let handles_before = decoder.remaining_handles();
2227            if let Some((inlined, num_bytes, num_handles)) =
2228                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2229            {
2230                let member_inline_size = <fidl_fuchsia_tracing::BufferingMode as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2231                if inlined != (member_inline_size <= 4) {
2232                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2233                }
2234                let inner_offset;
2235                let mut inner_depth = depth.clone();
2236                if inlined {
2237                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2238                    inner_offset = next_offset;
2239                } else {
2240                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2241                    inner_depth.increment()?;
2242                }
2243                let val_ref = self.buffering_mode.get_or_insert_with(|| {
2244                    fidl::new_empty!(fidl_fuchsia_tracing::BufferingMode, D)
2245                });
2246                fidl::decode!(
2247                    fidl_fuchsia_tracing::BufferingMode,
2248                    D,
2249                    val_ref,
2250                    decoder,
2251                    inner_offset,
2252                    inner_depth
2253                )?;
2254                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2255                {
2256                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2257                }
2258                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2259                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2260                }
2261            }
2262
2263            next_offset += envelope_size;
2264            _next_ordinal_to_read += 1;
2265            if next_offset >= end_offset {
2266                return Ok(());
2267            }
2268
2269            // Decode unknown envelopes for gaps in ordinals.
2270            while _next_ordinal_to_read < 4 {
2271                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2272                _next_ordinal_to_read += 1;
2273                next_offset += envelope_size;
2274            }
2275
2276            let next_out_of_line = decoder.next_out_of_line();
2277            let handles_before = decoder.remaining_handles();
2278            if let Some((inlined, num_bytes, num_handles)) =
2279                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2280            {
2281                let member_inline_size =
2282                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2283                if inlined != (member_inline_size <= 4) {
2284                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2285                }
2286                let inner_offset;
2287                let mut inner_depth = depth.clone();
2288                if inlined {
2289                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2290                    inner_offset = next_offset;
2291                } else {
2292                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2293                    inner_depth.increment()?;
2294                }
2295                let val_ref =
2296                    self.buffer_wrapped_count.get_or_insert_with(|| fidl::new_empty!(u32, D));
2297                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
2298                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2299                {
2300                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2301                }
2302                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2303                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2304                }
2305            }
2306
2307            next_offset += envelope_size;
2308            _next_ordinal_to_read += 1;
2309            if next_offset >= end_offset {
2310                return Ok(());
2311            }
2312
2313            // Decode unknown envelopes for gaps in ordinals.
2314            while _next_ordinal_to_read < 5 {
2315                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2316                _next_ordinal_to_read += 1;
2317                next_offset += envelope_size;
2318            }
2319
2320            let next_out_of_line = decoder.next_out_of_line();
2321            let handles_before = decoder.remaining_handles();
2322            if let Some((inlined, num_bytes, num_handles)) =
2323                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2324            {
2325                let member_inline_size =
2326                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2327                if inlined != (member_inline_size <= 4) {
2328                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2329                }
2330                let inner_offset;
2331                let mut inner_depth = depth.clone();
2332                if inlined {
2333                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2334                    inner_offset = next_offset;
2335                } else {
2336                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2337                    inner_depth.increment()?;
2338                }
2339                let val_ref = self.records_dropped.get_or_insert_with(|| fidl::new_empty!(u64, D));
2340                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
2341                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2342                {
2343                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2344                }
2345                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2346                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2347                }
2348            }
2349
2350            next_offset += envelope_size;
2351            _next_ordinal_to_read += 1;
2352            if next_offset >= end_offset {
2353                return Ok(());
2354            }
2355
2356            // Decode unknown envelopes for gaps in ordinals.
2357            while _next_ordinal_to_read < 6 {
2358                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2359                _next_ordinal_to_read += 1;
2360                next_offset += envelope_size;
2361            }
2362
2363            let next_out_of_line = decoder.next_out_of_line();
2364            let handles_before = decoder.remaining_handles();
2365            if let Some((inlined, num_bytes, num_handles)) =
2366                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2367            {
2368                let member_inline_size =
2369                    <f32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2370                if inlined != (member_inline_size <= 4) {
2371                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2372                }
2373                let inner_offset;
2374                let mut inner_depth = depth.clone();
2375                if inlined {
2376                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2377                    inner_offset = next_offset;
2378                } else {
2379                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2380                    inner_depth.increment()?;
2381                }
2382                let val_ref = self
2383                    .percentage_durable_buffer_used
2384                    .get_or_insert_with(|| fidl::new_empty!(f32, D));
2385                fidl::decode!(f32, D, val_ref, decoder, inner_offset, inner_depth)?;
2386                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2387                {
2388                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2389                }
2390                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2391                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2392                }
2393            }
2394
2395            next_offset += envelope_size;
2396            _next_ordinal_to_read += 1;
2397            if next_offset >= end_offset {
2398                return Ok(());
2399            }
2400
2401            // Decode unknown envelopes for gaps in ordinals.
2402            while _next_ordinal_to_read < 7 {
2403                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2404                _next_ordinal_to_read += 1;
2405                next_offset += envelope_size;
2406            }
2407
2408            let next_out_of_line = decoder.next_out_of_line();
2409            let handles_before = decoder.remaining_handles();
2410            if let Some((inlined, num_bytes, num_handles)) =
2411                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2412            {
2413                let member_inline_size =
2414                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2415                if inlined != (member_inline_size <= 4) {
2416                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2417                }
2418                let inner_offset;
2419                let mut inner_depth = depth.clone();
2420                if inlined {
2421                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2422                    inner_offset = next_offset;
2423                } else {
2424                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2425                    inner_depth.increment()?;
2426                }
2427                let val_ref =
2428                    self.non_durable_bytes_written.get_or_insert_with(|| fidl::new_empty!(u64, D));
2429                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
2430                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2431                {
2432                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2433                }
2434                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2435                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2436                }
2437            }
2438
2439            next_offset += envelope_size;
2440
2441            // Decode the remaining unknown envelopes.
2442            while next_offset < end_offset {
2443                _next_ordinal_to_read += 1;
2444                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2445                next_offset += envelope_size;
2446            }
2447
2448            Ok(())
2449        }
2450    }
2451
2452    impl StartOptions {
2453        #[inline(always)]
2454        fn max_ordinal_present(&self) -> u64 {
2455            if let Some(_) = self.additional_categories {
2456                return 2;
2457            }
2458            if let Some(_) = self.buffer_disposition {
2459                return 1;
2460            }
2461            0
2462        }
2463    }
2464
2465    impl fidl::encoding::ValueTypeMarker for StartOptions {
2466        type Borrowed<'a> = &'a Self;
2467        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2468            value
2469        }
2470    }
2471
2472    unsafe impl fidl::encoding::TypeMarker for StartOptions {
2473        type Owned = Self;
2474
2475        #[inline(always)]
2476        fn inline_align(_context: fidl::encoding::Context) -> usize {
2477            8
2478        }
2479
2480        #[inline(always)]
2481        fn inline_size(_context: fidl::encoding::Context) -> usize {
2482            16
2483        }
2484    }
2485
2486    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StartOptions, D>
2487        for &StartOptions
2488    {
2489        unsafe fn encode(
2490            self,
2491            encoder: &mut fidl::encoding::Encoder<'_, D>,
2492            offset: usize,
2493            mut depth: fidl::encoding::Depth,
2494        ) -> fidl::Result<()> {
2495            encoder.debug_check_bounds::<StartOptions>(offset);
2496            // Vector header
2497            let max_ordinal: u64 = self.max_ordinal_present();
2498            encoder.write_num(max_ordinal, offset);
2499            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2500            // Calling encoder.out_of_line_offset(0) is not allowed.
2501            if max_ordinal == 0 {
2502                return Ok(());
2503            }
2504            depth.increment()?;
2505            let envelope_size = 8;
2506            let bytes_len = max_ordinal as usize * envelope_size;
2507            #[allow(unused_variables)]
2508            let offset = encoder.out_of_line_offset(bytes_len);
2509            let mut _prev_end_offset: usize = 0;
2510            if 1 > max_ordinal {
2511                return Ok(());
2512            }
2513
2514            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2515            // are envelope_size bytes.
2516            let cur_offset: usize = (1 - 1) * envelope_size;
2517
2518            // Zero reserved fields.
2519            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2520
2521            // Safety:
2522            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2523            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2524            //   envelope_size bytes, there is always sufficient room.
2525            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_tracing::BufferDisposition, D>(
2526            self.buffer_disposition.as_ref().map(<fidl_fuchsia_tracing::BufferDisposition as fidl::encoding::ValueTypeMarker>::borrow),
2527            encoder, offset + cur_offset, depth
2528        )?;
2529
2530            _prev_end_offset = cur_offset + envelope_size;
2531            if 2 > max_ordinal {
2532                return Ok(());
2533            }
2534
2535            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2536            // are envelope_size bytes.
2537            let cur_offset: usize = (2 - 1) * envelope_size;
2538
2539            // Zero reserved fields.
2540            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2541
2542            // Safety:
2543            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2544            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2545            //   envelope_size bytes, there is always sufficient room.
2546            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 5000>, D>(
2547            self.additional_categories.as_ref().map(<fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 5000> as fidl::encoding::ValueTypeMarker>::borrow),
2548            encoder, offset + cur_offset, depth
2549        )?;
2550
2551            _prev_end_offset = cur_offset + envelope_size;
2552
2553            Ok(())
2554        }
2555    }
2556
2557    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StartOptions {
2558        #[inline(always)]
2559        fn new_empty() -> Self {
2560            Self::default()
2561        }
2562
2563        unsafe fn decode(
2564            &mut self,
2565            decoder: &mut fidl::encoding::Decoder<'_, D>,
2566            offset: usize,
2567            mut depth: fidl::encoding::Depth,
2568        ) -> fidl::Result<()> {
2569            decoder.debug_check_bounds::<Self>(offset);
2570            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2571                None => return Err(fidl::Error::NotNullable),
2572                Some(len) => len,
2573            };
2574            // Calling decoder.out_of_line_offset(0) is not allowed.
2575            if len == 0 {
2576                return Ok(());
2577            };
2578            depth.increment()?;
2579            let envelope_size = 8;
2580            let bytes_len = len * envelope_size;
2581            let offset = decoder.out_of_line_offset(bytes_len)?;
2582            // Decode the envelope for each type.
2583            let mut _next_ordinal_to_read = 0;
2584            let mut next_offset = offset;
2585            let end_offset = offset + bytes_len;
2586            _next_ordinal_to_read += 1;
2587            if next_offset >= end_offset {
2588                return Ok(());
2589            }
2590
2591            // Decode unknown envelopes for gaps in ordinals.
2592            while _next_ordinal_to_read < 1 {
2593                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2594                _next_ordinal_to_read += 1;
2595                next_offset += envelope_size;
2596            }
2597
2598            let next_out_of_line = decoder.next_out_of_line();
2599            let handles_before = decoder.remaining_handles();
2600            if let Some((inlined, num_bytes, num_handles)) =
2601                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2602            {
2603                let member_inline_size = <fidl_fuchsia_tracing::BufferDisposition as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2604                if inlined != (member_inline_size <= 4) {
2605                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2606                }
2607                let inner_offset;
2608                let mut inner_depth = depth.clone();
2609                if inlined {
2610                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2611                    inner_offset = next_offset;
2612                } else {
2613                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2614                    inner_depth.increment()?;
2615                }
2616                let val_ref = self.buffer_disposition.get_or_insert_with(|| {
2617                    fidl::new_empty!(fidl_fuchsia_tracing::BufferDisposition, D)
2618                });
2619                fidl::decode!(
2620                    fidl_fuchsia_tracing::BufferDisposition,
2621                    D,
2622                    val_ref,
2623                    decoder,
2624                    inner_offset,
2625                    inner_depth
2626                )?;
2627                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2628                {
2629                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2630                }
2631                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2632                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2633                }
2634            }
2635
2636            next_offset += envelope_size;
2637            _next_ordinal_to_read += 1;
2638            if next_offset >= end_offset {
2639                return Ok(());
2640            }
2641
2642            // Decode unknown envelopes for gaps in ordinals.
2643            while _next_ordinal_to_read < 2 {
2644                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2645                _next_ordinal_to_read += 1;
2646                next_offset += envelope_size;
2647            }
2648
2649            let next_out_of_line = decoder.next_out_of_line();
2650            let handles_before = decoder.remaining_handles();
2651            if let Some((inlined, num_bytes, num_handles)) =
2652                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2653            {
2654                let member_inline_size = <fidl::encoding::Vector<
2655                    fidl::encoding::BoundedString<100>,
2656                    5000,
2657                > as fidl::encoding::TypeMarker>::inline_size(
2658                    decoder.context
2659                );
2660                if inlined != (member_inline_size <= 4) {
2661                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2662                }
2663                let inner_offset;
2664                let mut inner_depth = depth.clone();
2665                if inlined {
2666                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2667                    inner_offset = next_offset;
2668                } else {
2669                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2670                    inner_depth.increment()?;
2671                }
2672                let val_ref = self.additional_categories.get_or_insert_with(|| {
2673                    fidl::new_empty!(
2674                        fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 5000>,
2675                        D
2676                    )
2677                });
2678                fidl::decode!(
2679                    fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 5000>,
2680                    D,
2681                    val_ref,
2682                    decoder,
2683                    inner_offset,
2684                    inner_depth
2685                )?;
2686                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2687                {
2688                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2689                }
2690                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2691                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2692                }
2693            }
2694
2695            next_offset += envelope_size;
2696
2697            // Decode the remaining unknown envelopes.
2698            while next_offset < end_offset {
2699                _next_ordinal_to_read += 1;
2700                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2701                next_offset += envelope_size;
2702            }
2703
2704            Ok(())
2705        }
2706    }
2707
2708    impl StopOptions {
2709        #[inline(always)]
2710        fn max_ordinal_present(&self) -> u64 {
2711            if let Some(_) = self.write_results {
2712                return 1;
2713            }
2714            0
2715        }
2716    }
2717
2718    impl fidl::encoding::ValueTypeMarker for StopOptions {
2719        type Borrowed<'a> = &'a Self;
2720        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2721            value
2722        }
2723    }
2724
2725    unsafe impl fidl::encoding::TypeMarker for StopOptions {
2726        type Owned = Self;
2727
2728        #[inline(always)]
2729        fn inline_align(_context: fidl::encoding::Context) -> usize {
2730            8
2731        }
2732
2733        #[inline(always)]
2734        fn inline_size(_context: fidl::encoding::Context) -> usize {
2735            16
2736        }
2737    }
2738
2739    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StopOptions, D>
2740        for &StopOptions
2741    {
2742        unsafe fn encode(
2743            self,
2744            encoder: &mut fidl::encoding::Encoder<'_, D>,
2745            offset: usize,
2746            mut depth: fidl::encoding::Depth,
2747        ) -> fidl::Result<()> {
2748            encoder.debug_check_bounds::<StopOptions>(offset);
2749            // Vector header
2750            let max_ordinal: u64 = self.max_ordinal_present();
2751            encoder.write_num(max_ordinal, offset);
2752            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2753            // Calling encoder.out_of_line_offset(0) is not allowed.
2754            if max_ordinal == 0 {
2755                return Ok(());
2756            }
2757            depth.increment()?;
2758            let envelope_size = 8;
2759            let bytes_len = max_ordinal as usize * envelope_size;
2760            #[allow(unused_variables)]
2761            let offset = encoder.out_of_line_offset(bytes_len);
2762            let mut _prev_end_offset: usize = 0;
2763            if 1 > max_ordinal {
2764                return Ok(());
2765            }
2766
2767            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2768            // are envelope_size bytes.
2769            let cur_offset: usize = (1 - 1) * envelope_size;
2770
2771            // Zero reserved fields.
2772            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2773
2774            // Safety:
2775            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2776            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2777            //   envelope_size bytes, there is always sufficient room.
2778            fidl::encoding::encode_in_envelope_optional::<bool, D>(
2779                self.write_results.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2780                encoder,
2781                offset + cur_offset,
2782                depth,
2783            )?;
2784
2785            _prev_end_offset = cur_offset + envelope_size;
2786
2787            Ok(())
2788        }
2789    }
2790
2791    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StopOptions {
2792        #[inline(always)]
2793        fn new_empty() -> Self {
2794            Self::default()
2795        }
2796
2797        unsafe fn decode(
2798            &mut self,
2799            decoder: &mut fidl::encoding::Decoder<'_, D>,
2800            offset: usize,
2801            mut depth: fidl::encoding::Depth,
2802        ) -> fidl::Result<()> {
2803            decoder.debug_check_bounds::<Self>(offset);
2804            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2805                None => return Err(fidl::Error::NotNullable),
2806                Some(len) => len,
2807            };
2808            // Calling decoder.out_of_line_offset(0) is not allowed.
2809            if len == 0 {
2810                return Ok(());
2811            };
2812            depth.increment()?;
2813            let envelope_size = 8;
2814            let bytes_len = len * envelope_size;
2815            let offset = decoder.out_of_line_offset(bytes_len)?;
2816            // Decode the envelope for each type.
2817            let mut _next_ordinal_to_read = 0;
2818            let mut next_offset = offset;
2819            let end_offset = offset + bytes_len;
2820            _next_ordinal_to_read += 1;
2821            if next_offset >= end_offset {
2822                return Ok(());
2823            }
2824
2825            // Decode unknown envelopes for gaps in ordinals.
2826            while _next_ordinal_to_read < 1 {
2827                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2828                _next_ordinal_to_read += 1;
2829                next_offset += envelope_size;
2830            }
2831
2832            let next_out_of_line = decoder.next_out_of_line();
2833            let handles_before = decoder.remaining_handles();
2834            if let Some((inlined, num_bytes, num_handles)) =
2835                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2836            {
2837                let member_inline_size =
2838                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2839                if inlined != (member_inline_size <= 4) {
2840                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2841                }
2842                let inner_offset;
2843                let mut inner_depth = depth.clone();
2844                if inlined {
2845                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2846                    inner_offset = next_offset;
2847                } else {
2848                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2849                    inner_depth.increment()?;
2850                }
2851                let val_ref = self.write_results.get_or_insert_with(|| fidl::new_empty!(bool, D));
2852                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2853                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2854                {
2855                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2856                }
2857                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2858                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2859                }
2860            }
2861
2862            next_offset += envelope_size;
2863
2864            // Decode the remaining unknown envelopes.
2865            while next_offset < end_offset {
2866                _next_ordinal_to_read += 1;
2867                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2868                next_offset += envelope_size;
2869            }
2870
2871            Ok(())
2872        }
2873    }
2874
2875    impl StopResult {
2876        #[inline(always)]
2877        fn max_ordinal_present(&self) -> u64 {
2878            if let Some(_) = self.provider_stats {
2879                return 1;
2880            }
2881            0
2882        }
2883    }
2884
2885    impl fidl::encoding::ValueTypeMarker for StopResult {
2886        type Borrowed<'a> = &'a Self;
2887        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2888            value
2889        }
2890    }
2891
2892    unsafe impl fidl::encoding::TypeMarker for StopResult {
2893        type Owned = Self;
2894
2895        #[inline(always)]
2896        fn inline_align(_context: fidl::encoding::Context) -> usize {
2897            8
2898        }
2899
2900        #[inline(always)]
2901        fn inline_size(_context: fidl::encoding::Context) -> usize {
2902            16
2903        }
2904    }
2905
2906    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StopResult, D>
2907        for &StopResult
2908    {
2909        unsafe fn encode(
2910            self,
2911            encoder: &mut fidl::encoding::Encoder<'_, D>,
2912            offset: usize,
2913            mut depth: fidl::encoding::Depth,
2914        ) -> fidl::Result<()> {
2915            encoder.debug_check_bounds::<StopResult>(offset);
2916            // Vector header
2917            let max_ordinal: u64 = self.max_ordinal_present();
2918            encoder.write_num(max_ordinal, offset);
2919            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2920            // Calling encoder.out_of_line_offset(0) is not allowed.
2921            if max_ordinal == 0 {
2922                return Ok(());
2923            }
2924            depth.increment()?;
2925            let envelope_size = 8;
2926            let bytes_len = max_ordinal as usize * envelope_size;
2927            #[allow(unused_variables)]
2928            let offset = encoder.out_of_line_offset(bytes_len);
2929            let mut _prev_end_offset: usize = 0;
2930            if 1 > max_ordinal {
2931                return Ok(());
2932            }
2933
2934            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2935            // are envelope_size bytes.
2936            let cur_offset: usize = (1 - 1) * envelope_size;
2937
2938            // Zero reserved fields.
2939            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2940
2941            // Safety:
2942            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2943            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2944            //   envelope_size bytes, there is always sufficient room.
2945            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ProviderStats, 100>, D>(
2946            self.provider_stats.as_ref().map(<fidl::encoding::Vector<ProviderStats, 100> as fidl::encoding::ValueTypeMarker>::borrow),
2947            encoder, offset + cur_offset, depth
2948        )?;
2949
2950            _prev_end_offset = cur_offset + envelope_size;
2951
2952            Ok(())
2953        }
2954    }
2955
2956    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StopResult {
2957        #[inline(always)]
2958        fn new_empty() -> Self {
2959            Self::default()
2960        }
2961
2962        unsafe fn decode(
2963            &mut self,
2964            decoder: &mut fidl::encoding::Decoder<'_, D>,
2965            offset: usize,
2966            mut depth: fidl::encoding::Depth,
2967        ) -> fidl::Result<()> {
2968            decoder.debug_check_bounds::<Self>(offset);
2969            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2970                None => return Err(fidl::Error::NotNullable),
2971                Some(len) => len,
2972            };
2973            // Calling decoder.out_of_line_offset(0) is not allowed.
2974            if len == 0 {
2975                return Ok(());
2976            };
2977            depth.increment()?;
2978            let envelope_size = 8;
2979            let bytes_len = len * envelope_size;
2980            let offset = decoder.out_of_line_offset(bytes_len)?;
2981            // Decode the envelope for each type.
2982            let mut _next_ordinal_to_read = 0;
2983            let mut next_offset = offset;
2984            let end_offset = offset + bytes_len;
2985            _next_ordinal_to_read += 1;
2986            if next_offset >= end_offset {
2987                return Ok(());
2988            }
2989
2990            // Decode unknown envelopes for gaps in ordinals.
2991            while _next_ordinal_to_read < 1 {
2992                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2993                _next_ordinal_to_read += 1;
2994                next_offset += envelope_size;
2995            }
2996
2997            let next_out_of_line = decoder.next_out_of_line();
2998            let handles_before = decoder.remaining_handles();
2999            if let Some((inlined, num_bytes, num_handles)) =
3000                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3001            {
3002                let member_inline_size = <fidl::encoding::Vector<ProviderStats, 100> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3003                if inlined != (member_inline_size <= 4) {
3004                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3005                }
3006                let inner_offset;
3007                let mut inner_depth = depth.clone();
3008                if inlined {
3009                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3010                    inner_offset = next_offset;
3011                } else {
3012                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3013                    inner_depth.increment()?;
3014                }
3015                let val_ref = self.provider_stats.get_or_insert_with(
3016                    || fidl::new_empty!(fidl::encoding::Vector<ProviderStats, 100>, D),
3017                );
3018                fidl::decode!(fidl::encoding::Vector<ProviderStats, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
3019                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3020                {
3021                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3022                }
3023                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3024                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3025                }
3026            }
3027
3028            next_offset += envelope_size;
3029
3030            // Decode the remaining unknown envelopes.
3031            while next_offset < end_offset {
3032                _next_ordinal_to_read += 1;
3033                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3034                next_offset += envelope_size;
3035            }
3036
3037            Ok(())
3038        }
3039    }
3040
3041    impl TraceConfig {
3042        #[inline(always)]
3043        fn max_ordinal_present(&self) -> u64 {
3044            if let Some(_) = self.version {
3045                return 6;
3046            }
3047            if let Some(_) = self.provider_specs {
3048                return 5;
3049            }
3050            if let Some(_) = self.buffering_mode {
3051                return 4;
3052            }
3053            if let Some(_) = self.start_timeout_milliseconds {
3054                return 3;
3055            }
3056            if let Some(_) = self.buffer_size_megabytes_hint {
3057                return 2;
3058            }
3059            if let Some(_) = self.categories {
3060                return 1;
3061            }
3062            0
3063        }
3064    }
3065
3066    impl fidl::encoding::ValueTypeMarker for TraceConfig {
3067        type Borrowed<'a> = &'a Self;
3068        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3069            value
3070        }
3071    }
3072
3073    unsafe impl fidl::encoding::TypeMarker for TraceConfig {
3074        type Owned = Self;
3075
3076        #[inline(always)]
3077        fn inline_align(_context: fidl::encoding::Context) -> usize {
3078            8
3079        }
3080
3081        #[inline(always)]
3082        fn inline_size(_context: fidl::encoding::Context) -> usize {
3083            16
3084        }
3085    }
3086
3087    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TraceConfig, D>
3088        for &TraceConfig
3089    {
3090        unsafe fn encode(
3091            self,
3092            encoder: &mut fidl::encoding::Encoder<'_, D>,
3093            offset: usize,
3094            mut depth: fidl::encoding::Depth,
3095        ) -> fidl::Result<()> {
3096            encoder.debug_check_bounds::<TraceConfig>(offset);
3097            // Vector header
3098            let max_ordinal: u64 = self.max_ordinal_present();
3099            encoder.write_num(max_ordinal, offset);
3100            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3101            // Calling encoder.out_of_line_offset(0) is not allowed.
3102            if max_ordinal == 0 {
3103                return Ok(());
3104            }
3105            depth.increment()?;
3106            let envelope_size = 8;
3107            let bytes_len = max_ordinal as usize * envelope_size;
3108            #[allow(unused_variables)]
3109            let offset = encoder.out_of_line_offset(bytes_len);
3110            let mut _prev_end_offset: usize = 0;
3111            if 1 > max_ordinal {
3112                return Ok(());
3113            }
3114
3115            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3116            // are envelope_size bytes.
3117            let cur_offset: usize = (1 - 1) * envelope_size;
3118
3119            // Zero reserved fields.
3120            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3121
3122            // Safety:
3123            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3124            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3125            //   envelope_size bytes, there is always sufficient room.
3126            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 5000>, D>(
3127            self.categories.as_ref().map(<fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 5000> as fidl::encoding::ValueTypeMarker>::borrow),
3128            encoder, offset + cur_offset, depth
3129        )?;
3130
3131            _prev_end_offset = cur_offset + envelope_size;
3132            if 2 > max_ordinal {
3133                return Ok(());
3134            }
3135
3136            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3137            // are envelope_size bytes.
3138            let cur_offset: usize = (2 - 1) * envelope_size;
3139
3140            // Zero reserved fields.
3141            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3142
3143            // Safety:
3144            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3145            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3146            //   envelope_size bytes, there is always sufficient room.
3147            fidl::encoding::encode_in_envelope_optional::<u32, D>(
3148                self.buffer_size_megabytes_hint
3149                    .as_ref()
3150                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3151                encoder,
3152                offset + cur_offset,
3153                depth,
3154            )?;
3155
3156            _prev_end_offset = cur_offset + envelope_size;
3157            if 3 > max_ordinal {
3158                return Ok(());
3159            }
3160
3161            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3162            // are envelope_size bytes.
3163            let cur_offset: usize = (3 - 1) * envelope_size;
3164
3165            // Zero reserved fields.
3166            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3167
3168            // Safety:
3169            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3170            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3171            //   envelope_size bytes, there is always sufficient room.
3172            fidl::encoding::encode_in_envelope_optional::<u64, D>(
3173                self.start_timeout_milliseconds
3174                    .as_ref()
3175                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3176                encoder,
3177                offset + cur_offset,
3178                depth,
3179            )?;
3180
3181            _prev_end_offset = cur_offset + envelope_size;
3182            if 4 > max_ordinal {
3183                return Ok(());
3184            }
3185
3186            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3187            // are envelope_size bytes.
3188            let cur_offset: usize = (4 - 1) * envelope_size;
3189
3190            // Zero reserved fields.
3191            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3192
3193            // Safety:
3194            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3195            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3196            //   envelope_size bytes, there is always sufficient room.
3197            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_tracing::BufferingMode, D>(
3198            self.buffering_mode.as_ref().map(<fidl_fuchsia_tracing::BufferingMode as fidl::encoding::ValueTypeMarker>::borrow),
3199            encoder, offset + cur_offset, depth
3200        )?;
3201
3202            _prev_end_offset = cur_offset + envelope_size;
3203            if 5 > max_ordinal {
3204                return Ok(());
3205            }
3206
3207            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3208            // are envelope_size bytes.
3209            let cur_offset: usize = (5 - 1) * envelope_size;
3210
3211            // Zero reserved fields.
3212            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3213
3214            // Safety:
3215            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3216            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3217            //   envelope_size bytes, there is always sufficient room.
3218            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ProviderSpec, 100>, D>(
3219            self.provider_specs.as_ref().map(<fidl::encoding::Vector<ProviderSpec, 100> as fidl::encoding::ValueTypeMarker>::borrow),
3220            encoder, offset + cur_offset, depth
3221        )?;
3222
3223            _prev_end_offset = cur_offset + envelope_size;
3224            if 6 > max_ordinal {
3225                return Ok(());
3226            }
3227
3228            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3229            // are envelope_size bytes.
3230            let cur_offset: usize = (6 - 1) * envelope_size;
3231
3232            // Zero reserved fields.
3233            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3234
3235            // Safety:
3236            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3237            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3238            //   envelope_size bytes, there is always sufficient room.
3239            fidl::encoding::encode_in_envelope_optional::<FxtVersion, D>(
3240                self.version.as_ref().map(<FxtVersion as fidl::encoding::ValueTypeMarker>::borrow),
3241                encoder,
3242                offset + cur_offset,
3243                depth,
3244            )?;
3245
3246            _prev_end_offset = cur_offset + envelope_size;
3247
3248            Ok(())
3249        }
3250    }
3251
3252    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TraceConfig {
3253        #[inline(always)]
3254        fn new_empty() -> Self {
3255            Self::default()
3256        }
3257
3258        unsafe fn decode(
3259            &mut self,
3260            decoder: &mut fidl::encoding::Decoder<'_, D>,
3261            offset: usize,
3262            mut depth: fidl::encoding::Depth,
3263        ) -> fidl::Result<()> {
3264            decoder.debug_check_bounds::<Self>(offset);
3265            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3266                None => return Err(fidl::Error::NotNullable),
3267                Some(len) => len,
3268            };
3269            // Calling decoder.out_of_line_offset(0) is not allowed.
3270            if len == 0 {
3271                return Ok(());
3272            };
3273            depth.increment()?;
3274            let envelope_size = 8;
3275            let bytes_len = len * envelope_size;
3276            let offset = decoder.out_of_line_offset(bytes_len)?;
3277            // Decode the envelope for each type.
3278            let mut _next_ordinal_to_read = 0;
3279            let mut next_offset = offset;
3280            let end_offset = offset + bytes_len;
3281            _next_ordinal_to_read += 1;
3282            if next_offset >= end_offset {
3283                return Ok(());
3284            }
3285
3286            // Decode unknown envelopes for gaps in ordinals.
3287            while _next_ordinal_to_read < 1 {
3288                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3289                _next_ordinal_to_read += 1;
3290                next_offset += envelope_size;
3291            }
3292
3293            let next_out_of_line = decoder.next_out_of_line();
3294            let handles_before = decoder.remaining_handles();
3295            if let Some((inlined, num_bytes, num_handles)) =
3296                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3297            {
3298                let member_inline_size = <fidl::encoding::Vector<
3299                    fidl::encoding::BoundedString<100>,
3300                    5000,
3301                > as fidl::encoding::TypeMarker>::inline_size(
3302                    decoder.context
3303                );
3304                if inlined != (member_inline_size <= 4) {
3305                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3306                }
3307                let inner_offset;
3308                let mut inner_depth = depth.clone();
3309                if inlined {
3310                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3311                    inner_offset = next_offset;
3312                } else {
3313                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3314                    inner_depth.increment()?;
3315                }
3316                let val_ref = self.categories.get_or_insert_with(|| {
3317                    fidl::new_empty!(
3318                        fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 5000>,
3319                        D
3320                    )
3321                });
3322                fidl::decode!(
3323                    fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 5000>,
3324                    D,
3325                    val_ref,
3326                    decoder,
3327                    inner_offset,
3328                    inner_depth
3329                )?;
3330                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3331                {
3332                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3333                }
3334                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3335                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3336                }
3337            }
3338
3339            next_offset += envelope_size;
3340            _next_ordinal_to_read += 1;
3341            if next_offset >= end_offset {
3342                return Ok(());
3343            }
3344
3345            // Decode unknown envelopes for gaps in ordinals.
3346            while _next_ordinal_to_read < 2 {
3347                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3348                _next_ordinal_to_read += 1;
3349                next_offset += envelope_size;
3350            }
3351
3352            let next_out_of_line = decoder.next_out_of_line();
3353            let handles_before = decoder.remaining_handles();
3354            if let Some((inlined, num_bytes, num_handles)) =
3355                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3356            {
3357                let member_inline_size =
3358                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3359                if inlined != (member_inline_size <= 4) {
3360                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3361                }
3362                let inner_offset;
3363                let mut inner_depth = depth.clone();
3364                if inlined {
3365                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3366                    inner_offset = next_offset;
3367                } else {
3368                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3369                    inner_depth.increment()?;
3370                }
3371                let val_ref =
3372                    self.buffer_size_megabytes_hint.get_or_insert_with(|| fidl::new_empty!(u32, D));
3373                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
3374                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3375                {
3376                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3377                }
3378                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3379                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3380                }
3381            }
3382
3383            next_offset += envelope_size;
3384            _next_ordinal_to_read += 1;
3385            if next_offset >= end_offset {
3386                return Ok(());
3387            }
3388
3389            // Decode unknown envelopes for gaps in ordinals.
3390            while _next_ordinal_to_read < 3 {
3391                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3392                _next_ordinal_to_read += 1;
3393                next_offset += envelope_size;
3394            }
3395
3396            let next_out_of_line = decoder.next_out_of_line();
3397            let handles_before = decoder.remaining_handles();
3398            if let Some((inlined, num_bytes, num_handles)) =
3399                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3400            {
3401                let member_inline_size =
3402                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3403                if inlined != (member_inline_size <= 4) {
3404                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3405                }
3406                let inner_offset;
3407                let mut inner_depth = depth.clone();
3408                if inlined {
3409                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3410                    inner_offset = next_offset;
3411                } else {
3412                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3413                    inner_depth.increment()?;
3414                }
3415                let val_ref =
3416                    self.start_timeout_milliseconds.get_or_insert_with(|| fidl::new_empty!(u64, D));
3417                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
3418                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3419                {
3420                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3421                }
3422                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3423                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3424                }
3425            }
3426
3427            next_offset += envelope_size;
3428            _next_ordinal_to_read += 1;
3429            if next_offset >= end_offset {
3430                return Ok(());
3431            }
3432
3433            // Decode unknown envelopes for gaps in ordinals.
3434            while _next_ordinal_to_read < 4 {
3435                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3436                _next_ordinal_to_read += 1;
3437                next_offset += envelope_size;
3438            }
3439
3440            let next_out_of_line = decoder.next_out_of_line();
3441            let handles_before = decoder.remaining_handles();
3442            if let Some((inlined, num_bytes, num_handles)) =
3443                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3444            {
3445                let member_inline_size = <fidl_fuchsia_tracing::BufferingMode as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3446                if inlined != (member_inline_size <= 4) {
3447                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3448                }
3449                let inner_offset;
3450                let mut inner_depth = depth.clone();
3451                if inlined {
3452                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3453                    inner_offset = next_offset;
3454                } else {
3455                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3456                    inner_depth.increment()?;
3457                }
3458                let val_ref = self.buffering_mode.get_or_insert_with(|| {
3459                    fidl::new_empty!(fidl_fuchsia_tracing::BufferingMode, D)
3460                });
3461                fidl::decode!(
3462                    fidl_fuchsia_tracing::BufferingMode,
3463                    D,
3464                    val_ref,
3465                    decoder,
3466                    inner_offset,
3467                    inner_depth
3468                )?;
3469                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3470                {
3471                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3472                }
3473                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3474                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3475                }
3476            }
3477
3478            next_offset += envelope_size;
3479            _next_ordinal_to_read += 1;
3480            if next_offset >= end_offset {
3481                return Ok(());
3482            }
3483
3484            // Decode unknown envelopes for gaps in ordinals.
3485            while _next_ordinal_to_read < 5 {
3486                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3487                _next_ordinal_to_read += 1;
3488                next_offset += envelope_size;
3489            }
3490
3491            let next_out_of_line = decoder.next_out_of_line();
3492            let handles_before = decoder.remaining_handles();
3493            if let Some((inlined, num_bytes, num_handles)) =
3494                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3495            {
3496                let member_inline_size = <fidl::encoding::Vector<ProviderSpec, 100> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3497                if inlined != (member_inline_size <= 4) {
3498                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3499                }
3500                let inner_offset;
3501                let mut inner_depth = depth.clone();
3502                if inlined {
3503                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3504                    inner_offset = next_offset;
3505                } else {
3506                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3507                    inner_depth.increment()?;
3508                }
3509                let val_ref = self.provider_specs.get_or_insert_with(
3510                    || fidl::new_empty!(fidl::encoding::Vector<ProviderSpec, 100>, D),
3511                );
3512                fidl::decode!(fidl::encoding::Vector<ProviderSpec, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
3513                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3514                {
3515                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3516                }
3517                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3518                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3519                }
3520            }
3521
3522            next_offset += envelope_size;
3523            _next_ordinal_to_read += 1;
3524            if next_offset >= end_offset {
3525                return Ok(());
3526            }
3527
3528            // Decode unknown envelopes for gaps in ordinals.
3529            while _next_ordinal_to_read < 6 {
3530                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3531                _next_ordinal_to_read += 1;
3532                next_offset += envelope_size;
3533            }
3534
3535            let next_out_of_line = decoder.next_out_of_line();
3536            let handles_before = decoder.remaining_handles();
3537            if let Some((inlined, num_bytes, num_handles)) =
3538                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3539            {
3540                let member_inline_size =
3541                    <FxtVersion as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3542                if inlined != (member_inline_size <= 4) {
3543                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3544                }
3545                let inner_offset;
3546                let mut inner_depth = depth.clone();
3547                if inlined {
3548                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3549                    inner_offset = next_offset;
3550                } else {
3551                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3552                    inner_depth.increment()?;
3553                }
3554                let val_ref = self.version.get_or_insert_with(|| fidl::new_empty!(FxtVersion, D));
3555                fidl::decode!(FxtVersion, D, val_ref, decoder, inner_offset, inner_depth)?;
3556                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3557                {
3558                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3559                }
3560                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3561                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3562                }
3563            }
3564
3565            next_offset += envelope_size;
3566
3567            // Decode the remaining unknown envelopes.
3568            while next_offset < end_offset {
3569                _next_ordinal_to_read += 1;
3570                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3571                next_offset += envelope_size;
3572            }
3573
3574            Ok(())
3575        }
3576    }
3577}