fidl_fuchsia_tracing_controller/
fidl_fuchsia_tracing_controller.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::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13/// aliases
14pub type AlertName = String;
15
16/// The maximum length of an alert name.
17pub const MAX_ALERT_NAME_LENGTH: u32 = 14;
18
19/// The maximum number of providers supported.
20pub const MAX_NUM_PROVIDERS: u32 = 100;
21
22/// The state of the tracing session.
23/// A "session" is everything between `Initialize` and `Terminate`.
24#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
25pub enum SessionState {
26    /// The tracing system is ready for a new session.
27    /// There can be only one session at a time.
28    Ready,
29    /// A new tracing session has been initialized.
30    Initialized,
31    /// Tracing is in the midst of starting.
32    Starting,
33    /// Tracing has started.
34    Started,
35    /// Tracing is in the midst of being stopped.
36    Stopping,
37    /// Tracing has fully stopped.
38    Stopped,
39    /// Tracing is in the midst of being terminated.
40    /// Once the system has completely terminated the session it goes back
41    /// to the READY state.
42    Terminating,
43    #[doc(hidden)]
44    __SourceBreaking { unknown_ordinal: u32 },
45}
46
47/// Pattern that matches an unknown `SessionState` member.
48#[macro_export]
49macro_rules! SessionStateUnknown {
50    () => {
51        _
52    };
53}
54
55impl SessionState {
56    #[inline]
57    pub fn from_primitive(prim: u32) -> Option<Self> {
58        match prim {
59            1 => Some(Self::Ready),
60            2 => Some(Self::Initialized),
61            3 => Some(Self::Starting),
62            4 => Some(Self::Started),
63            5 => Some(Self::Stopping),
64            6 => Some(Self::Stopped),
65            7 => Some(Self::Terminating),
66            _ => None,
67        }
68    }
69
70    #[inline]
71    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
72        match prim {
73            1 => Self::Ready,
74            2 => Self::Initialized,
75            3 => Self::Starting,
76            4 => Self::Started,
77            5 => Self::Stopping,
78            6 => Self::Stopped,
79            7 => Self::Terminating,
80            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
81        }
82    }
83
84    #[inline]
85    pub fn unknown() -> Self {
86        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
87    }
88
89    #[inline]
90    pub const fn into_primitive(self) -> u32 {
91        match self {
92            Self::Ready => 1,
93            Self::Initialized => 2,
94            Self::Starting => 3,
95            Self::Started => 4,
96            Self::Stopping => 5,
97            Self::Stopped => 6,
98            Self::Terminating => 7,
99            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
100        }
101    }
102
103    #[inline]
104    pub fn is_unknown(&self) -> bool {
105        match self {
106            Self::__SourceBreaking { unknown_ordinal: _ } => true,
107            _ => false,
108        }
109    }
110}
111
112/// Error codes from Start operations.
113#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
114pub enum StartError {
115    /// Tracing hasn't been initialized, not ready to start.
116    NotInitialized,
117    /// Tracing has already been started.
118    AlreadyStarted,
119    /// Tracing is currently being stopped.
120    Stopping,
121    /// Tracing is currently being terminated.
122    Terminating,
123    #[doc(hidden)]
124    __SourceBreaking { unknown_ordinal: u32 },
125}
126
127/// Pattern that matches an unknown `StartError` member.
128#[macro_export]
129macro_rules! StartErrorUnknown {
130    () => {
131        _
132    };
133}
134
135impl StartError {
136    #[inline]
137    pub fn from_primitive(prim: u32) -> Option<Self> {
138        match prim {
139            1 => Some(Self::NotInitialized),
140            2 => Some(Self::AlreadyStarted),
141            3 => Some(Self::Stopping),
142            4 => Some(Self::Terminating),
143            _ => None,
144        }
145    }
146
147    #[inline]
148    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
149        match prim {
150            1 => Self::NotInitialized,
151            2 => Self::AlreadyStarted,
152            3 => Self::Stopping,
153            4 => Self::Terminating,
154            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
155        }
156    }
157
158    #[inline]
159    pub fn unknown() -> Self {
160        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
161    }
162
163    #[inline]
164    pub const fn into_primitive(self) -> u32 {
165        match self {
166            Self::NotInitialized => 1,
167            Self::AlreadyStarted => 2,
168            Self::Stopping => 3,
169            Self::Terminating => 4,
170            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
171        }
172    }
173
174    #[inline]
175    pub fn is_unknown(&self) -> bool {
176        match self {
177            Self::__SourceBreaking { unknown_ordinal: _ } => true,
178            _ => false,
179        }
180    }
181}
182
183/// Error codes from Stop operations.
184#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
185pub enum StopError {
186    /// Trace controller is unavailable. Nothing to stop.
187    NotInitialized,
188    /// Tracing has not started or is currently stoppped.
189    NotStarted,
190    /// Tracing aborted due to error.
191    Aborted,
192    #[doc(hidden)]
193    __SourceBreaking { unknown_ordinal: u32 },
194}
195
196/// Pattern that matches an unknown `StopError` member.
197#[macro_export]
198macro_rules! StopErrorUnknown {
199    () => {
200        _
201    };
202}
203
204impl StopError {
205    #[inline]
206    pub fn from_primitive(prim: u32) -> Option<Self> {
207        match prim {
208            1 => Some(Self::NotInitialized),
209            2 => Some(Self::NotStarted),
210            3 => Some(Self::Aborted),
211            _ => None,
212        }
213    }
214
215    #[inline]
216    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
217        match prim {
218            1 => Self::NotInitialized,
219            2 => Self::NotStarted,
220            3 => Self::Aborted,
221            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
222        }
223    }
224
225    #[inline]
226    pub fn unknown() -> Self {
227        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
228    }
229
230    #[inline]
231    pub const fn into_primitive(self) -> u32 {
232        match self {
233            Self::NotInitialized => 1,
234            Self::NotStarted => 2,
235            Self::Aborted => 3,
236            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
237        }
238    }
239
240    #[inline]
241    pub fn is_unknown(&self) -> bool {
242        match self {
243            Self::__SourceBreaking { unknown_ordinal: _ } => true,
244            _ => false,
245        }
246    }
247}
248
249#[derive(Debug, PartialEq)]
250pub struct ProvisionerInitializeTracingRequest {
251    pub controller: fidl::endpoints::ServerEnd<SessionMarker>,
252    pub config: TraceConfig,
253    pub output: fidl::Socket,
254}
255
256impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
257    for ProvisionerInitializeTracingRequest
258{
259}
260
261#[derive(Clone, Debug, PartialEq)]
262pub struct ProvisionerGetKnownCategoriesResponse {
263    pub categories: Vec<fidl_fuchsia_tracing::KnownCategory>,
264}
265
266impl fidl::Persistable for ProvisionerGetKnownCategoriesResponse {}
267
268#[derive(Clone, Debug, PartialEq)]
269pub struct ProvisionerGetProvidersResponse {
270    pub providers: Vec<ProviderInfo>,
271}
272
273impl fidl::Persistable for ProvisionerGetProvidersResponse {}
274
275#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
276pub struct SessionOnSessionStateChangeRequest {
277    pub state: SessionState,
278}
279
280impl fidl::Persistable for SessionOnSessionStateChangeRequest {}
281
282#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
283pub struct SessionWatchAlertResponse {
284    pub alert_name: String,
285}
286
287impl fidl::Persistable for SessionWatchAlertResponse {}
288
289/// Version of trace record format.
290///
291/// Default to the latest available version, which is currently 0.1.
292///
293/// More information about the format of trace records can be found here:
294/// https://fuchsia.dev/fuchsia-src/reference/tracing/trace-format
295#[derive(Clone, Debug, Default, PartialEq)]
296pub struct FxtVersion {
297    /// Defaults to 0.
298    pub major: Option<u32>,
299    /// Defaults to 1
300    pub minor: Option<u32>,
301    #[doc(hidden)]
302    pub __source_breaking: fidl::marker::SourceBreaking,
303}
304
305impl fidl::Persistable for FxtVersion {}
306
307/// Result of `GetProviders`.
308#[derive(Clone, Debug, Default, PartialEq)]
309pub struct ProviderInfo {
310    /// The provider's ID, assigned by trace-manager.
311    pub id: Option<u32>,
312    /// The provider's pid.
313    pub pid: Option<u64>,
314    /// The name of the provider.
315    pub name: Option<String>,
316    #[doc(hidden)]
317    pub __source_breaking: fidl::marker::SourceBreaking,
318}
319
320impl fidl::Persistable for ProviderInfo {}
321
322#[derive(Clone, Debug, Default, PartialEq)]
323pub struct ProviderSpec {
324    pub name: Option<String>,
325    pub buffer_size_megabytes_hint: Option<u32>,
326    pub categories: Option<Vec<String>>,
327    #[doc(hidden)]
328    pub __source_breaking: fidl::marker::SourceBreaking,
329}
330
331impl fidl::Persistable for ProviderSpec {}
332
333/// Statistics data per provider collected over the course of the tracing session
334#[derive(Clone, Debug, Default, PartialEq)]
335pub struct ProviderStats {
336    pub name: Option<String>,
337    pub pid: Option<u64>,
338    pub buffering_mode: Option<fidl_fuchsia_tracing::BufferingMode>,
339    pub buffer_wrapped_count: Option<u32>,
340    pub records_dropped: Option<u64>,
341    pub percentage_durable_buffer_used: Option<f32>,
342    pub non_durable_bytes_written: Option<u64>,
343    #[doc(hidden)]
344    pub __source_breaking: fidl::marker::SourceBreaking,
345}
346
347impl fidl::Persistable for ProviderStats {}
348
349/// Additional options to control trace data collection.
350#[derive(Clone, Debug, Default, PartialEq)]
351pub struct StartOptions {
352    /// Whether and how to clear the buffer when starting data collection.
353    /// This allows, for example, multiple Start/Stop trace runs to be
354    /// collected in the same buffer.
355    ///
356    /// If the preceding `Stop()` request had `save_after_stopped=true`
357    /// then this value is overridden to CLEAR_ENTIRE_BUFFER to avoid
358    /// duplicate data being saved.
359    pub buffer_disposition: Option<fidl_fuchsia_tracing::BufferDisposition>,
360    /// The trace categories to add to the initial set provided in
361    /// `TraceConfig`. If the combined number of categories goes over the
362    /// limit then the extra categories past the limit are discarded.
363    pub additional_categories: Option<Vec<String>>,
364    #[doc(hidden)]
365    pub __source_breaking: fidl::marker::SourceBreaking,
366}
367
368impl fidl::Persistable for StartOptions {}
369
370/// Additional options to control stopping of a trace.
371#[derive(Clone, Debug, Default, PartialEq)]
372pub struct StopOptions {
373    /// If true then write all collected data after tracing has stopped.
374    /// This is useful in situations where one wants to clear the buffer
375    /// before starting the next trace, without having to first terminate the
376    /// trace and start a new one.
377    pub write_results: Option<bool>,
378    #[doc(hidden)]
379    pub __source_breaking: fidl::marker::SourceBreaking,
380}
381
382impl fidl::Persistable for StopOptions {}
383
384/// Result of a terminate request.
385#[derive(Clone, Debug, Default, PartialEq)]
386pub struct StopResult {
387    pub provider_stats: Option<Vec<ProviderStats>>,
388    #[doc(hidden)]
389    pub __source_breaking: fidl::marker::SourceBreaking,
390}
391
392impl fidl::Persistable for StopResult {}
393
394/// Provides options for the trace.
395#[derive(Clone, Debug, Default, PartialEq)]
396pub struct TraceConfig {
397    /// The trace categories to record, or an empty array for all.
398    pub categories: Option<Vec<String>>,
399    /// Suggested size of trace buffer which each provider should receive.
400    pub buffer_size_megabytes_hint: Option<u32>,
401    /// Acknowledge start request after at most `start_timeout_milliseconds`.
402    pub start_timeout_milliseconds: Option<u64>,
403    pub buffering_mode: Option<fidl_fuchsia_tracing::BufferingMode>,
404    /// Overrides for particular providers.
405    pub provider_specs: Option<Vec<ProviderSpec>>,
406    /// Maximum trace format version supported byt the client.
407    /// If not set, this defaults to the latest available trace format version.
408    pub version: Option<FxtVersion>,
409    #[doc(hidden)]
410    pub __source_breaking: fidl::marker::SourceBreaking,
411}
412
413impl fidl::Persistable for TraceConfig {}
414
415#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
416pub struct ProvisionerMarker;
417
418impl fidl::endpoints::ProtocolMarker for ProvisionerMarker {
419    type Proxy = ProvisionerProxy;
420    type RequestStream = ProvisionerRequestStream;
421    #[cfg(target_os = "fuchsia")]
422    type SynchronousProxy = ProvisionerSynchronousProxy;
423
424    const DEBUG_NAME: &'static str = "fuchsia.tracing.controller.Provisioner";
425}
426impl fidl::endpoints::DiscoverableProtocolMarker for ProvisionerMarker {}
427
428pub trait ProvisionerProxyInterface: Send + Sync {
429    fn r#initialize_tracing(
430        &self,
431        controller: fidl::endpoints::ServerEnd<SessionMarker>,
432        config: &TraceConfig,
433        output: fidl::Socket,
434    ) -> Result<(), fidl::Error>;
435    type GetProvidersResponseFut: std::future::Future<Output = Result<Vec<ProviderInfo>, fidl::Error>>
436        + Send;
437    fn r#get_providers(&self) -> Self::GetProvidersResponseFut;
438    type GetKnownCategoriesResponseFut: std::future::Future<Output = Result<Vec<fidl_fuchsia_tracing::KnownCategory>, fidl::Error>>
439        + Send;
440    fn r#get_known_categories(&self) -> Self::GetKnownCategoriesResponseFut;
441}
442#[derive(Debug)]
443#[cfg(target_os = "fuchsia")]
444pub struct ProvisionerSynchronousProxy {
445    client: fidl::client::sync::Client,
446}
447
448#[cfg(target_os = "fuchsia")]
449impl fidl::endpoints::SynchronousProxy for ProvisionerSynchronousProxy {
450    type Proxy = ProvisionerProxy;
451    type Protocol = ProvisionerMarker;
452
453    fn from_channel(inner: fidl::Channel) -> Self {
454        Self::new(inner)
455    }
456
457    fn into_channel(self) -> fidl::Channel {
458        self.client.into_channel()
459    }
460
461    fn as_channel(&self) -> &fidl::Channel {
462        self.client.as_channel()
463    }
464}
465
466#[cfg(target_os = "fuchsia")]
467impl ProvisionerSynchronousProxy {
468    pub fn new(channel: fidl::Channel) -> Self {
469        let protocol_name = <ProvisionerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
470        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
471    }
472
473    pub fn into_channel(self) -> fidl::Channel {
474        self.client.into_channel()
475    }
476
477    /// Waits until an event arrives and returns it. It is safe for other
478    /// threads to make concurrent requests while waiting for an event.
479    pub fn wait_for_event(
480        &self,
481        deadline: zx::MonotonicInstant,
482    ) -> Result<ProvisionerEvent, fidl::Error> {
483        ProvisionerEvent::decode(self.client.wait_for_event(deadline)?)
484    }
485
486    /// Requests to initialize tracing with the specified `config`.
487    ///
488    /// A bad request will terminate the connection.
489    ///
490    /// Dropping the socket connection will abort and terminate the
491    /// existing trace Session.
492    ///
493    /// The trace controller emits trace data to `output` as a sequence of
494    /// binary formatted trace records.  Traces obtained from different providers
495    /// are delimited by metadata records within the stream.
496    pub fn r#initialize_tracing(
497        &self,
498        mut controller: fidl::endpoints::ServerEnd<SessionMarker>,
499        mut config: &TraceConfig,
500        mut output: fidl::Socket,
501    ) -> Result<(), fidl::Error> {
502        self.client.send::<ProvisionerInitializeTracingRequest>(
503            (controller, config, output),
504            0x3b046ed3a0684ab8,
505            fidl::encoding::DynamicFlags::FLEXIBLE,
506        )
507    }
508
509    /// Return the set of registered providers.
510    pub fn r#get_providers(
511        &self,
512        ___deadline: zx::MonotonicInstant,
513    ) -> Result<Vec<ProviderInfo>, fidl::Error> {
514        let _response = self.client.send_query::<
515            fidl::encoding::EmptyPayload,
516            fidl::encoding::FlexibleType<ProvisionerGetProvidersResponse>,
517        >(
518            (),
519            0xc4d4f36edc50d43,
520            fidl::encoding::DynamicFlags::FLEXIBLE,
521            ___deadline,
522        )?
523        .into_result::<ProvisionerMarker>("get_providers")?;
524        Ok(_response.providers)
525    }
526
527    pub fn r#get_known_categories(
528        &self,
529        ___deadline: zx::MonotonicInstant,
530    ) -> Result<Vec<fidl_fuchsia_tracing::KnownCategory>, fidl::Error> {
531        let _response = self.client.send_query::<
532            fidl::encoding::EmptyPayload,
533            fidl::encoding::FlexibleType<ProvisionerGetKnownCategoriesResponse>,
534        >(
535            (),
536            0x41ef99397b945a4,
537            fidl::encoding::DynamicFlags::FLEXIBLE,
538            ___deadline,
539        )?
540        .into_result::<ProvisionerMarker>("get_known_categories")?;
541        Ok(_response.categories)
542    }
543}
544
545#[derive(Debug, Clone)]
546pub struct ProvisionerProxy {
547    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
548}
549
550impl fidl::endpoints::Proxy for ProvisionerProxy {
551    type Protocol = ProvisionerMarker;
552
553    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
554        Self::new(inner)
555    }
556
557    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
558        self.client.into_channel().map_err(|client| Self { client })
559    }
560
561    fn as_channel(&self) -> &::fidl::AsyncChannel {
562        self.client.as_channel()
563    }
564}
565
566impl ProvisionerProxy {
567    /// Create a new Proxy for fuchsia.tracing.controller/Provisioner.
568    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
569        let protocol_name = <ProvisionerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
570        Self { client: fidl::client::Client::new(channel, protocol_name) }
571    }
572
573    /// Get a Stream of events from the remote end of the protocol.
574    ///
575    /// # Panics
576    ///
577    /// Panics if the event stream was already taken.
578    pub fn take_event_stream(&self) -> ProvisionerEventStream {
579        ProvisionerEventStream { event_receiver: self.client.take_event_receiver() }
580    }
581
582    /// Requests to initialize tracing with the specified `config`.
583    ///
584    /// A bad request will terminate the connection.
585    ///
586    /// Dropping the socket connection will abort and terminate the
587    /// existing trace Session.
588    ///
589    /// The trace controller emits trace data to `output` as a sequence of
590    /// binary formatted trace records.  Traces obtained from different providers
591    /// are delimited by metadata records within the stream.
592    pub fn r#initialize_tracing(
593        &self,
594        mut controller: fidl::endpoints::ServerEnd<SessionMarker>,
595        mut config: &TraceConfig,
596        mut output: fidl::Socket,
597    ) -> Result<(), fidl::Error> {
598        ProvisionerProxyInterface::r#initialize_tracing(self, controller, config, output)
599    }
600
601    /// Return the set of registered providers.
602    pub fn r#get_providers(
603        &self,
604    ) -> fidl::client::QueryResponseFut<
605        Vec<ProviderInfo>,
606        fidl::encoding::DefaultFuchsiaResourceDialect,
607    > {
608        ProvisionerProxyInterface::r#get_providers(self)
609    }
610
611    pub fn r#get_known_categories(
612        &self,
613    ) -> fidl::client::QueryResponseFut<
614        Vec<fidl_fuchsia_tracing::KnownCategory>,
615        fidl::encoding::DefaultFuchsiaResourceDialect,
616    > {
617        ProvisionerProxyInterface::r#get_known_categories(self)
618    }
619}
620
621impl ProvisionerProxyInterface for ProvisionerProxy {
622    fn r#initialize_tracing(
623        &self,
624        mut controller: fidl::endpoints::ServerEnd<SessionMarker>,
625        mut config: &TraceConfig,
626        mut output: fidl::Socket,
627    ) -> Result<(), fidl::Error> {
628        self.client.send::<ProvisionerInitializeTracingRequest>(
629            (controller, config, output),
630            0x3b046ed3a0684ab8,
631            fidl::encoding::DynamicFlags::FLEXIBLE,
632        )
633    }
634
635    type GetProvidersResponseFut = fidl::client::QueryResponseFut<
636        Vec<ProviderInfo>,
637        fidl::encoding::DefaultFuchsiaResourceDialect,
638    >;
639    fn r#get_providers(&self) -> Self::GetProvidersResponseFut {
640        fn _decode(
641            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
642        ) -> Result<Vec<ProviderInfo>, fidl::Error> {
643            let _response = fidl::client::decode_transaction_body::<
644                fidl::encoding::FlexibleType<ProvisionerGetProvidersResponse>,
645                fidl::encoding::DefaultFuchsiaResourceDialect,
646                0xc4d4f36edc50d43,
647            >(_buf?)?
648            .into_result::<ProvisionerMarker>("get_providers")?;
649            Ok(_response.providers)
650        }
651        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<ProviderInfo>>(
652            (),
653            0xc4d4f36edc50d43,
654            fidl::encoding::DynamicFlags::FLEXIBLE,
655            _decode,
656        )
657    }
658
659    type GetKnownCategoriesResponseFut = fidl::client::QueryResponseFut<
660        Vec<fidl_fuchsia_tracing::KnownCategory>,
661        fidl::encoding::DefaultFuchsiaResourceDialect,
662    >;
663    fn r#get_known_categories(&self) -> Self::GetKnownCategoriesResponseFut {
664        fn _decode(
665            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
666        ) -> Result<Vec<fidl_fuchsia_tracing::KnownCategory>, fidl::Error> {
667            let _response = fidl::client::decode_transaction_body::<
668                fidl::encoding::FlexibleType<ProvisionerGetKnownCategoriesResponse>,
669                fidl::encoding::DefaultFuchsiaResourceDialect,
670                0x41ef99397b945a4,
671            >(_buf?)?
672            .into_result::<ProvisionerMarker>("get_known_categories")?;
673            Ok(_response.categories)
674        }
675        self.client.send_query_and_decode::<
676            fidl::encoding::EmptyPayload,
677            Vec<fidl_fuchsia_tracing::KnownCategory>,
678        >(
679            (),
680            0x41ef99397b945a4,
681            fidl::encoding::DynamicFlags::FLEXIBLE,
682            _decode,
683        )
684    }
685}
686
687pub struct ProvisionerEventStream {
688    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
689}
690
691impl std::marker::Unpin for ProvisionerEventStream {}
692
693impl futures::stream::FusedStream for ProvisionerEventStream {
694    fn is_terminated(&self) -> bool {
695        self.event_receiver.is_terminated()
696    }
697}
698
699impl futures::Stream for ProvisionerEventStream {
700    type Item = Result<ProvisionerEvent, fidl::Error>;
701
702    fn poll_next(
703        mut self: std::pin::Pin<&mut Self>,
704        cx: &mut std::task::Context<'_>,
705    ) -> std::task::Poll<Option<Self::Item>> {
706        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
707            &mut self.event_receiver,
708            cx
709        )?) {
710            Some(buf) => std::task::Poll::Ready(Some(ProvisionerEvent::decode(buf))),
711            None => std::task::Poll::Ready(None),
712        }
713    }
714}
715
716#[derive(Debug)]
717pub enum ProvisionerEvent {
718    #[non_exhaustive]
719    _UnknownEvent {
720        /// Ordinal of the event that was sent.
721        ordinal: u64,
722    },
723}
724
725impl ProvisionerEvent {
726    /// Decodes a message buffer as a [`ProvisionerEvent`].
727    fn decode(
728        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
729    ) -> Result<ProvisionerEvent, fidl::Error> {
730        let (bytes, _handles) = buf.split_mut();
731        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
732        debug_assert_eq!(tx_header.tx_id, 0);
733        match tx_header.ordinal {
734            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
735                Ok(ProvisionerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
736            }
737            _ => Err(fidl::Error::UnknownOrdinal {
738                ordinal: tx_header.ordinal,
739                protocol_name: <ProvisionerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
740            }),
741        }
742    }
743}
744
745/// A Stream of incoming requests for fuchsia.tracing.controller/Provisioner.
746pub struct ProvisionerRequestStream {
747    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
748    is_terminated: bool,
749}
750
751impl std::marker::Unpin for ProvisionerRequestStream {}
752
753impl futures::stream::FusedStream for ProvisionerRequestStream {
754    fn is_terminated(&self) -> bool {
755        self.is_terminated
756    }
757}
758
759impl fidl::endpoints::RequestStream for ProvisionerRequestStream {
760    type Protocol = ProvisionerMarker;
761    type ControlHandle = ProvisionerControlHandle;
762
763    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
764        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
765    }
766
767    fn control_handle(&self) -> Self::ControlHandle {
768        ProvisionerControlHandle { inner: self.inner.clone() }
769    }
770
771    fn into_inner(
772        self,
773    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
774    {
775        (self.inner, self.is_terminated)
776    }
777
778    fn from_inner(
779        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
780        is_terminated: bool,
781    ) -> Self {
782        Self { inner, is_terminated }
783    }
784}
785
786impl futures::Stream for ProvisionerRequestStream {
787    type Item = Result<ProvisionerRequest, fidl::Error>;
788
789    fn poll_next(
790        mut self: std::pin::Pin<&mut Self>,
791        cx: &mut std::task::Context<'_>,
792    ) -> std::task::Poll<Option<Self::Item>> {
793        let this = &mut *self;
794        if this.inner.check_shutdown(cx) {
795            this.is_terminated = true;
796            return std::task::Poll::Ready(None);
797        }
798        if this.is_terminated {
799            panic!("polled ProvisionerRequestStream after completion");
800        }
801        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
802            |bytes, handles| {
803                match this.inner.channel().read_etc(cx, bytes, handles) {
804                    std::task::Poll::Ready(Ok(())) => {}
805                    std::task::Poll::Pending => return std::task::Poll::Pending,
806                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
807                        this.is_terminated = true;
808                        return std::task::Poll::Ready(None);
809                    }
810                    std::task::Poll::Ready(Err(e)) => {
811                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
812                            e.into(),
813                        ))))
814                    }
815                }
816
817                // A message has been received from the channel
818                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
819
820                std::task::Poll::Ready(Some(match header.ordinal {
821                    0x3b046ed3a0684ab8 => {
822                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
823                        let mut req = fidl::new_empty!(
824                            ProvisionerInitializeTracingRequest,
825                            fidl::encoding::DefaultFuchsiaResourceDialect
826                        );
827                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProvisionerInitializeTracingRequest>(&header, _body_bytes, handles, &mut req)?;
828                        let control_handle = ProvisionerControlHandle { inner: this.inner.clone() };
829                        Ok(ProvisionerRequest::InitializeTracing {
830                            controller: req.controller,
831                            config: req.config,
832                            output: req.output,
833
834                            control_handle,
835                        })
836                    }
837                    0xc4d4f36edc50d43 => {
838                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
839                        let mut req = fidl::new_empty!(
840                            fidl::encoding::EmptyPayload,
841                            fidl::encoding::DefaultFuchsiaResourceDialect
842                        );
843                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
844                        let control_handle = ProvisionerControlHandle { inner: this.inner.clone() };
845                        Ok(ProvisionerRequest::GetProviders {
846                            responder: ProvisionerGetProvidersResponder {
847                                control_handle: std::mem::ManuallyDrop::new(control_handle),
848                                tx_id: header.tx_id,
849                            },
850                        })
851                    }
852                    0x41ef99397b945a4 => {
853                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
854                        let mut req = fidl::new_empty!(
855                            fidl::encoding::EmptyPayload,
856                            fidl::encoding::DefaultFuchsiaResourceDialect
857                        );
858                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
859                        let control_handle = ProvisionerControlHandle { inner: this.inner.clone() };
860                        Ok(ProvisionerRequest::GetKnownCategories {
861                            responder: ProvisionerGetKnownCategoriesResponder {
862                                control_handle: std::mem::ManuallyDrop::new(control_handle),
863                                tx_id: header.tx_id,
864                            },
865                        })
866                    }
867                    _ if header.tx_id == 0
868                        && header
869                            .dynamic_flags()
870                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
871                    {
872                        Ok(ProvisionerRequest::_UnknownMethod {
873                            ordinal: header.ordinal,
874                            control_handle: ProvisionerControlHandle { inner: this.inner.clone() },
875                            method_type: fidl::MethodType::OneWay,
876                        })
877                    }
878                    _ if header
879                        .dynamic_flags()
880                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
881                    {
882                        this.inner.send_framework_err(
883                            fidl::encoding::FrameworkErr::UnknownMethod,
884                            header.tx_id,
885                            header.ordinal,
886                            header.dynamic_flags(),
887                            (bytes, handles),
888                        )?;
889                        Ok(ProvisionerRequest::_UnknownMethod {
890                            ordinal: header.ordinal,
891                            control_handle: ProvisionerControlHandle { inner: this.inner.clone() },
892                            method_type: fidl::MethodType::TwoWay,
893                        })
894                    }
895                    _ => Err(fidl::Error::UnknownOrdinal {
896                        ordinal: header.ordinal,
897                        protocol_name:
898                            <ProvisionerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
899                    }),
900                }))
901            },
902        )
903    }
904}
905
906/// The provisioner interface used to initialize a trace Session, that can
907/// then be started and stopped.
908///
909/// The provisioner is required to start a trace Session and bind the control
910/// to the client. It can also perform tasks like getting the list of registered
911/// providers and known categories, which can be performed without a existing
912/// trace Session.
913#[derive(Debug)]
914pub enum ProvisionerRequest {
915    /// Requests to initialize tracing with the specified `config`.
916    ///
917    /// A bad request will terminate the connection.
918    ///
919    /// Dropping the socket connection will abort and terminate the
920    /// existing trace Session.
921    ///
922    /// The trace controller emits trace data to `output` as a sequence of
923    /// binary formatted trace records.  Traces obtained from different providers
924    /// are delimited by metadata records within the stream.
925    InitializeTracing {
926        controller: fidl::endpoints::ServerEnd<SessionMarker>,
927        config: TraceConfig,
928        output: fidl::Socket,
929        control_handle: ProvisionerControlHandle,
930    },
931    /// Return the set of registered providers.
932    GetProviders {
933        responder: ProvisionerGetProvidersResponder,
934    },
935    GetKnownCategories {
936        responder: ProvisionerGetKnownCategoriesResponder,
937    },
938    /// An interaction was received which does not match any known method.
939    #[non_exhaustive]
940    _UnknownMethod {
941        /// Ordinal of the method that was called.
942        ordinal: u64,
943        control_handle: ProvisionerControlHandle,
944        method_type: fidl::MethodType,
945    },
946}
947
948impl ProvisionerRequest {
949    #[allow(irrefutable_let_patterns)]
950    pub fn into_initialize_tracing(
951        self,
952    ) -> Option<(
953        fidl::endpoints::ServerEnd<SessionMarker>,
954        TraceConfig,
955        fidl::Socket,
956        ProvisionerControlHandle,
957    )> {
958        if let ProvisionerRequest::InitializeTracing {
959            controller,
960            config,
961            output,
962            control_handle,
963        } = self
964        {
965            Some((controller, config, output, control_handle))
966        } else {
967            None
968        }
969    }
970
971    #[allow(irrefutable_let_patterns)]
972    pub fn into_get_providers(self) -> Option<(ProvisionerGetProvidersResponder)> {
973        if let ProvisionerRequest::GetProviders { responder } = self {
974            Some((responder))
975        } else {
976            None
977        }
978    }
979
980    #[allow(irrefutable_let_patterns)]
981    pub fn into_get_known_categories(self) -> Option<(ProvisionerGetKnownCategoriesResponder)> {
982        if let ProvisionerRequest::GetKnownCategories { responder } = self {
983            Some((responder))
984        } else {
985            None
986        }
987    }
988
989    /// Name of the method defined in FIDL
990    pub fn method_name(&self) -> &'static str {
991        match *self {
992            ProvisionerRequest::InitializeTracing { .. } => "initialize_tracing",
993            ProvisionerRequest::GetProviders { .. } => "get_providers",
994            ProvisionerRequest::GetKnownCategories { .. } => "get_known_categories",
995            ProvisionerRequest::_UnknownMethod {
996                method_type: fidl::MethodType::OneWay, ..
997            } => "unknown one-way method",
998            ProvisionerRequest::_UnknownMethod {
999                method_type: fidl::MethodType::TwoWay, ..
1000            } => "unknown two-way method",
1001        }
1002    }
1003}
1004
1005#[derive(Debug, Clone)]
1006pub struct ProvisionerControlHandle {
1007    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1008}
1009
1010impl fidl::endpoints::ControlHandle for ProvisionerControlHandle {
1011    fn shutdown(&self) {
1012        self.inner.shutdown()
1013    }
1014    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1015        self.inner.shutdown_with_epitaph(status)
1016    }
1017
1018    fn is_closed(&self) -> bool {
1019        self.inner.channel().is_closed()
1020    }
1021    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1022        self.inner.channel().on_closed()
1023    }
1024
1025    #[cfg(target_os = "fuchsia")]
1026    fn signal_peer(
1027        &self,
1028        clear_mask: zx::Signals,
1029        set_mask: zx::Signals,
1030    ) -> Result<(), zx_status::Status> {
1031        use fidl::Peered;
1032        self.inner.channel().signal_peer(clear_mask, set_mask)
1033    }
1034}
1035
1036impl ProvisionerControlHandle {}
1037
1038#[must_use = "FIDL methods require a response to be sent"]
1039#[derive(Debug)]
1040pub struct ProvisionerGetProvidersResponder {
1041    control_handle: std::mem::ManuallyDrop<ProvisionerControlHandle>,
1042    tx_id: u32,
1043}
1044
1045/// Set the the channel to be shutdown (see [`ProvisionerControlHandle::shutdown`])
1046/// if the responder is dropped without sending a response, so that the client
1047/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1048impl std::ops::Drop for ProvisionerGetProvidersResponder {
1049    fn drop(&mut self) {
1050        self.control_handle.shutdown();
1051        // Safety: drops once, never accessed again
1052        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1053    }
1054}
1055
1056impl fidl::endpoints::Responder for ProvisionerGetProvidersResponder {
1057    type ControlHandle = ProvisionerControlHandle;
1058
1059    fn control_handle(&self) -> &ProvisionerControlHandle {
1060        &self.control_handle
1061    }
1062
1063    fn drop_without_shutdown(mut self) {
1064        // Safety: drops once, never accessed again due to mem::forget
1065        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1066        // Prevent Drop from running (which would shut down the channel)
1067        std::mem::forget(self);
1068    }
1069}
1070
1071impl ProvisionerGetProvidersResponder {
1072    /// Sends a response to the FIDL transaction.
1073    ///
1074    /// Sets the channel to shutdown if an error occurs.
1075    pub fn send(self, mut providers: &[ProviderInfo]) -> Result<(), fidl::Error> {
1076        let _result = self.send_raw(providers);
1077        if _result.is_err() {
1078            self.control_handle.shutdown();
1079        }
1080        self.drop_without_shutdown();
1081        _result
1082    }
1083
1084    /// Similar to "send" but does not shutdown the channel if an error occurs.
1085    pub fn send_no_shutdown_on_err(
1086        self,
1087        mut providers: &[ProviderInfo],
1088    ) -> Result<(), fidl::Error> {
1089        let _result = self.send_raw(providers);
1090        self.drop_without_shutdown();
1091        _result
1092    }
1093
1094    fn send_raw(&self, mut providers: &[ProviderInfo]) -> Result<(), fidl::Error> {
1095        self.control_handle
1096            .inner
1097            .send::<fidl::encoding::FlexibleType<ProvisionerGetProvidersResponse>>(
1098                fidl::encoding::Flexible::new((providers,)),
1099                self.tx_id,
1100                0xc4d4f36edc50d43,
1101                fidl::encoding::DynamicFlags::FLEXIBLE,
1102            )
1103    }
1104}
1105
1106#[must_use = "FIDL methods require a response to be sent"]
1107#[derive(Debug)]
1108pub struct ProvisionerGetKnownCategoriesResponder {
1109    control_handle: std::mem::ManuallyDrop<ProvisionerControlHandle>,
1110    tx_id: u32,
1111}
1112
1113/// Set the the channel to be shutdown (see [`ProvisionerControlHandle::shutdown`])
1114/// if the responder is dropped without sending a response, so that the client
1115/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1116impl std::ops::Drop for ProvisionerGetKnownCategoriesResponder {
1117    fn drop(&mut self) {
1118        self.control_handle.shutdown();
1119        // Safety: drops once, never accessed again
1120        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1121    }
1122}
1123
1124impl fidl::endpoints::Responder for ProvisionerGetKnownCategoriesResponder {
1125    type ControlHandle = ProvisionerControlHandle;
1126
1127    fn control_handle(&self) -> &ProvisionerControlHandle {
1128        &self.control_handle
1129    }
1130
1131    fn drop_without_shutdown(mut self) {
1132        // Safety: drops once, never accessed again due to mem::forget
1133        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1134        // Prevent Drop from running (which would shut down the channel)
1135        std::mem::forget(self);
1136    }
1137}
1138
1139impl ProvisionerGetKnownCategoriesResponder {
1140    /// Sends a response to the FIDL transaction.
1141    ///
1142    /// Sets the channel to shutdown if an error occurs.
1143    pub fn send(
1144        self,
1145        mut categories: &[fidl_fuchsia_tracing::KnownCategory],
1146    ) -> Result<(), fidl::Error> {
1147        let _result = self.send_raw(categories);
1148        if _result.is_err() {
1149            self.control_handle.shutdown();
1150        }
1151        self.drop_without_shutdown();
1152        _result
1153    }
1154
1155    /// Similar to "send" but does not shutdown the channel if an error occurs.
1156    pub fn send_no_shutdown_on_err(
1157        self,
1158        mut categories: &[fidl_fuchsia_tracing::KnownCategory],
1159    ) -> Result<(), fidl::Error> {
1160        let _result = self.send_raw(categories);
1161        self.drop_without_shutdown();
1162        _result
1163    }
1164
1165    fn send_raw(
1166        &self,
1167        mut categories: &[fidl_fuchsia_tracing::KnownCategory],
1168    ) -> Result<(), fidl::Error> {
1169        self.control_handle
1170            .inner
1171            .send::<fidl::encoding::FlexibleType<ProvisionerGetKnownCategoriesResponse>>(
1172                fidl::encoding::Flexible::new((categories,)),
1173                self.tx_id,
1174                0x41ef99397b945a4,
1175                fidl::encoding::DynamicFlags::FLEXIBLE,
1176            )
1177    }
1178}
1179
1180#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1181pub struct SessionMarker;
1182
1183impl fidl::endpoints::ProtocolMarker for SessionMarker {
1184    type Proxy = SessionProxy;
1185    type RequestStream = SessionRequestStream;
1186    #[cfg(target_os = "fuchsia")]
1187    type SynchronousProxy = SessionSynchronousProxy;
1188
1189    const DEBUG_NAME: &'static str = "(anonymous) Session";
1190}
1191pub type SessionStartTracingResult = Result<(), StartError>;
1192pub type SessionStopTracingResult = Result<StopResult, StopError>;
1193
1194pub trait SessionProxyInterface: Send + Sync {
1195    type StartTracingResponseFut: std::future::Future<Output = Result<SessionStartTracingResult, fidl::Error>>
1196        + Send;
1197    fn r#start_tracing(&self, payload: &StartOptions) -> Self::StartTracingResponseFut;
1198    type StopTracingResponseFut: std::future::Future<Output = Result<SessionStopTracingResult, fidl::Error>>
1199        + Send;
1200    fn r#stop_tracing(&self, payload: &StopOptions) -> Self::StopTracingResponseFut;
1201    type WatchAlertResponseFut: std::future::Future<Output = Result<String, fidl::Error>> + Send;
1202    fn r#watch_alert(&self) -> Self::WatchAlertResponseFut;
1203}
1204#[derive(Debug)]
1205#[cfg(target_os = "fuchsia")]
1206pub struct SessionSynchronousProxy {
1207    client: fidl::client::sync::Client,
1208}
1209
1210#[cfg(target_os = "fuchsia")]
1211impl fidl::endpoints::SynchronousProxy for SessionSynchronousProxy {
1212    type Proxy = SessionProxy;
1213    type Protocol = SessionMarker;
1214
1215    fn from_channel(inner: fidl::Channel) -> Self {
1216        Self::new(inner)
1217    }
1218
1219    fn into_channel(self) -> fidl::Channel {
1220        self.client.into_channel()
1221    }
1222
1223    fn as_channel(&self) -> &fidl::Channel {
1224        self.client.as_channel()
1225    }
1226}
1227
1228#[cfg(target_os = "fuchsia")]
1229impl SessionSynchronousProxy {
1230    pub fn new(channel: fidl::Channel) -> Self {
1231        let protocol_name = <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1232        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1233    }
1234
1235    pub fn into_channel(self) -> fidl::Channel {
1236        self.client.into_channel()
1237    }
1238
1239    /// Waits until an event arrives and returns it. It is safe for other
1240    /// threads to make concurrent requests while waiting for an event.
1241    pub fn wait_for_event(
1242        &self,
1243        deadline: zx::MonotonicInstant,
1244    ) -> Result<SessionEvent, fidl::Error> {
1245        SessionEvent::decode(self.client.wait_for_event(deadline)?)
1246    }
1247
1248    /// Requests to start tracing with the specified `options`.
1249    ///
1250    /// If tracing has already started then the request is ignored,
1251    /// except to send back an error code.
1252    ///
1253    /// The trace Session acknowledges the request when all
1254    /// registered providers have been started or after
1255    /// `TraceConfig.start_timeout_milliseconds` milliseconds.
1256    /// One useful reason for the has-started acknowledgement is that the
1257    /// trace program can start a program to trace knowing that all the
1258    /// providers are started.
1259    pub fn r#start_tracing(
1260        &self,
1261        mut payload: &StartOptions,
1262        ___deadline: zx::MonotonicInstant,
1263    ) -> Result<SessionStartTracingResult, fidl::Error> {
1264        let _response = self.client.send_query::<
1265            StartOptions,
1266            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, StartError>,
1267        >(
1268            payload,
1269            0xde9b6ccbe936631,
1270            fidl::encoding::DynamicFlags::FLEXIBLE,
1271            ___deadline,
1272        )?
1273        .into_result::<SessionMarker>("start_tracing")?;
1274        Ok(_response.map(|x| x))
1275    }
1276
1277    /// Requests to stop tracing.
1278    ///
1279    /// If tracing has already stopped then this does nothing.
1280    /// Returning a result lets callers know when it's ok to, for example,
1281    /// start tracing again.
1282    pub fn r#stop_tracing(
1283        &self,
1284        mut payload: &StopOptions,
1285        ___deadline: zx::MonotonicInstant,
1286    ) -> Result<SessionStopTracingResult, fidl::Error> {
1287        let _response = self
1288            .client
1289            .send_query::<StopOptions, fidl::encoding::FlexibleResultType<StopResult, StopError>>(
1290                payload,
1291                0x50fefc9b3ff9b03a,
1292                fidl::encoding::DynamicFlags::FLEXIBLE,
1293                ___deadline,
1294            )?
1295            .into_result::<SessionMarker>("stop_tracing")?;
1296        Ok(_response.map(|x| x))
1297    }
1298
1299    /// Returns the next alert when it arrives.
1300    ///
1301    /// Alerts received by the Session are queued until a WatchAlert
1302    /// request is received. Alerts are sent to the caller in the order
1303    /// they were received.
1304    ///
1305    /// WatchAlert requests are also queued until an alert is received
1306    /// and the requests are serviced in the order they were received.
1307    pub fn r#watch_alert(&self, ___deadline: zx::MonotonicInstant) -> Result<String, fidl::Error> {
1308        let _response = self.client.send_query::<
1309            fidl::encoding::EmptyPayload,
1310            fidl::encoding::FlexibleType<SessionWatchAlertResponse>,
1311        >(
1312            (),
1313            0x1f1c080716d92276,
1314            fidl::encoding::DynamicFlags::FLEXIBLE,
1315            ___deadline,
1316        )?
1317        .into_result::<SessionMarker>("watch_alert")?;
1318        Ok(_response.alert_name)
1319    }
1320}
1321
1322#[derive(Debug, Clone)]
1323pub struct SessionProxy {
1324    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1325}
1326
1327impl fidl::endpoints::Proxy for SessionProxy {
1328    type Protocol = SessionMarker;
1329
1330    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1331        Self::new(inner)
1332    }
1333
1334    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1335        self.client.into_channel().map_err(|client| Self { client })
1336    }
1337
1338    fn as_channel(&self) -> &::fidl::AsyncChannel {
1339        self.client.as_channel()
1340    }
1341}
1342
1343impl SessionProxy {
1344    /// Create a new Proxy for fuchsia.tracing.controller/Session.
1345    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1346        let protocol_name = <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1347        Self { client: fidl::client::Client::new(channel, protocol_name) }
1348    }
1349
1350    /// Get a Stream of events from the remote end of the protocol.
1351    ///
1352    /// # Panics
1353    ///
1354    /// Panics if the event stream was already taken.
1355    pub fn take_event_stream(&self) -> SessionEventStream {
1356        SessionEventStream { event_receiver: self.client.take_event_receiver() }
1357    }
1358
1359    /// Requests to start tracing with the specified `options`.
1360    ///
1361    /// If tracing has already started then the request is ignored,
1362    /// except to send back an error code.
1363    ///
1364    /// The trace Session acknowledges the request when all
1365    /// registered providers have been started or after
1366    /// `TraceConfig.start_timeout_milliseconds` milliseconds.
1367    /// One useful reason for the has-started acknowledgement is that the
1368    /// trace program can start a program to trace knowing that all the
1369    /// providers are started.
1370    pub fn r#start_tracing(
1371        &self,
1372        mut payload: &StartOptions,
1373    ) -> fidl::client::QueryResponseFut<
1374        SessionStartTracingResult,
1375        fidl::encoding::DefaultFuchsiaResourceDialect,
1376    > {
1377        SessionProxyInterface::r#start_tracing(self, payload)
1378    }
1379
1380    /// Requests to stop tracing.
1381    ///
1382    /// If tracing has already stopped then this does nothing.
1383    /// Returning a result lets callers know when it's ok to, for example,
1384    /// start tracing again.
1385    pub fn r#stop_tracing(
1386        &self,
1387        mut payload: &StopOptions,
1388    ) -> fidl::client::QueryResponseFut<
1389        SessionStopTracingResult,
1390        fidl::encoding::DefaultFuchsiaResourceDialect,
1391    > {
1392        SessionProxyInterface::r#stop_tracing(self, payload)
1393    }
1394
1395    /// Returns the next alert when it arrives.
1396    ///
1397    /// Alerts received by the Session are queued until a WatchAlert
1398    /// request is received. Alerts are sent to the caller in the order
1399    /// they were received.
1400    ///
1401    /// WatchAlert requests are also queued until an alert is received
1402    /// and the requests are serviced in the order they were received.
1403    pub fn r#watch_alert(
1404        &self,
1405    ) -> fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect> {
1406        SessionProxyInterface::r#watch_alert(self)
1407    }
1408}
1409
1410impl SessionProxyInterface for SessionProxy {
1411    type StartTracingResponseFut = fidl::client::QueryResponseFut<
1412        SessionStartTracingResult,
1413        fidl::encoding::DefaultFuchsiaResourceDialect,
1414    >;
1415    fn r#start_tracing(&self, mut payload: &StartOptions) -> Self::StartTracingResponseFut {
1416        fn _decode(
1417            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1418        ) -> Result<SessionStartTracingResult, fidl::Error> {
1419            let _response = fidl::client::decode_transaction_body::<
1420                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, StartError>,
1421                fidl::encoding::DefaultFuchsiaResourceDialect,
1422                0xde9b6ccbe936631,
1423            >(_buf?)?
1424            .into_result::<SessionMarker>("start_tracing")?;
1425            Ok(_response.map(|x| x))
1426        }
1427        self.client.send_query_and_decode::<StartOptions, SessionStartTracingResult>(
1428            payload,
1429            0xde9b6ccbe936631,
1430            fidl::encoding::DynamicFlags::FLEXIBLE,
1431            _decode,
1432        )
1433    }
1434
1435    type StopTracingResponseFut = fidl::client::QueryResponseFut<
1436        SessionStopTracingResult,
1437        fidl::encoding::DefaultFuchsiaResourceDialect,
1438    >;
1439    fn r#stop_tracing(&self, mut payload: &StopOptions) -> Self::StopTracingResponseFut {
1440        fn _decode(
1441            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1442        ) -> Result<SessionStopTracingResult, fidl::Error> {
1443            let _response = fidl::client::decode_transaction_body::<
1444                fidl::encoding::FlexibleResultType<StopResult, StopError>,
1445                fidl::encoding::DefaultFuchsiaResourceDialect,
1446                0x50fefc9b3ff9b03a,
1447            >(_buf?)?
1448            .into_result::<SessionMarker>("stop_tracing")?;
1449            Ok(_response.map(|x| x))
1450        }
1451        self.client.send_query_and_decode::<StopOptions, SessionStopTracingResult>(
1452            payload,
1453            0x50fefc9b3ff9b03a,
1454            fidl::encoding::DynamicFlags::FLEXIBLE,
1455            _decode,
1456        )
1457    }
1458
1459    type WatchAlertResponseFut =
1460        fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect>;
1461    fn r#watch_alert(&self) -> Self::WatchAlertResponseFut {
1462        fn _decode(
1463            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1464        ) -> Result<String, fidl::Error> {
1465            let _response = fidl::client::decode_transaction_body::<
1466                fidl::encoding::FlexibleType<SessionWatchAlertResponse>,
1467                fidl::encoding::DefaultFuchsiaResourceDialect,
1468                0x1f1c080716d92276,
1469            >(_buf?)?
1470            .into_result::<SessionMarker>("watch_alert")?;
1471            Ok(_response.alert_name)
1472        }
1473        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, String>(
1474            (),
1475            0x1f1c080716d92276,
1476            fidl::encoding::DynamicFlags::FLEXIBLE,
1477            _decode,
1478        )
1479    }
1480}
1481
1482pub struct SessionEventStream {
1483    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1484}
1485
1486impl std::marker::Unpin for SessionEventStream {}
1487
1488impl futures::stream::FusedStream for SessionEventStream {
1489    fn is_terminated(&self) -> bool {
1490        self.event_receiver.is_terminated()
1491    }
1492}
1493
1494impl futures::Stream for SessionEventStream {
1495    type Item = Result<SessionEvent, fidl::Error>;
1496
1497    fn poll_next(
1498        mut self: std::pin::Pin<&mut Self>,
1499        cx: &mut std::task::Context<'_>,
1500    ) -> std::task::Poll<Option<Self::Item>> {
1501        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1502            &mut self.event_receiver,
1503            cx
1504        )?) {
1505            Some(buf) => std::task::Poll::Ready(Some(SessionEvent::decode(buf))),
1506            None => std::task::Poll::Ready(None),
1507        }
1508    }
1509}
1510
1511#[derive(Debug)]
1512pub enum SessionEvent {
1513    OnSessionStateChange {
1514        state: SessionState,
1515    },
1516    #[non_exhaustive]
1517    _UnknownEvent {
1518        /// Ordinal of the event that was sent.
1519        ordinal: u64,
1520    },
1521}
1522
1523impl SessionEvent {
1524    #[allow(irrefutable_let_patterns)]
1525    pub fn into_on_session_state_change(self) -> Option<SessionState> {
1526        if let SessionEvent::OnSessionStateChange { state } = self {
1527            Some((state))
1528        } else {
1529            None
1530        }
1531    }
1532
1533    /// Decodes a message buffer as a [`SessionEvent`].
1534    fn decode(
1535        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1536    ) -> Result<SessionEvent, fidl::Error> {
1537        let (bytes, _handles) = buf.split_mut();
1538        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1539        debug_assert_eq!(tx_header.tx_id, 0);
1540        match tx_header.ordinal {
1541            0x7ab1640718b971cd => {
1542                let mut out = fidl::new_empty!(
1543                    SessionOnSessionStateChangeRequest,
1544                    fidl::encoding::DefaultFuchsiaResourceDialect
1545                );
1546                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionOnSessionStateChangeRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1547                Ok((SessionEvent::OnSessionStateChange { state: out.state }))
1548            }
1549            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1550                Ok(SessionEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1551            }
1552            _ => Err(fidl::Error::UnknownOrdinal {
1553                ordinal: tx_header.ordinal,
1554                protocol_name: <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1555            }),
1556        }
1557    }
1558}
1559
1560/// A Stream of incoming requests for fuchsia.tracing.controller/Session.
1561pub struct SessionRequestStream {
1562    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1563    is_terminated: bool,
1564}
1565
1566impl std::marker::Unpin for SessionRequestStream {}
1567
1568impl futures::stream::FusedStream for SessionRequestStream {
1569    fn is_terminated(&self) -> bool {
1570        self.is_terminated
1571    }
1572}
1573
1574impl fidl::endpoints::RequestStream for SessionRequestStream {
1575    type Protocol = SessionMarker;
1576    type ControlHandle = SessionControlHandle;
1577
1578    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1579        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1580    }
1581
1582    fn control_handle(&self) -> Self::ControlHandle {
1583        SessionControlHandle { inner: self.inner.clone() }
1584    }
1585
1586    fn into_inner(
1587        self,
1588    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1589    {
1590        (self.inner, self.is_terminated)
1591    }
1592
1593    fn from_inner(
1594        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1595        is_terminated: bool,
1596    ) -> Self {
1597        Self { inner, is_terminated }
1598    }
1599}
1600
1601impl futures::Stream for SessionRequestStream {
1602    type Item = Result<SessionRequest, fidl::Error>;
1603
1604    fn poll_next(
1605        mut self: std::pin::Pin<&mut Self>,
1606        cx: &mut std::task::Context<'_>,
1607    ) -> std::task::Poll<Option<Self::Item>> {
1608        let this = &mut *self;
1609        if this.inner.check_shutdown(cx) {
1610            this.is_terminated = true;
1611            return std::task::Poll::Ready(None);
1612        }
1613        if this.is_terminated {
1614            panic!("polled SessionRequestStream after completion");
1615        }
1616        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1617            |bytes, handles| {
1618                match this.inner.channel().read_etc(cx, bytes, handles) {
1619                    std::task::Poll::Ready(Ok(())) => {}
1620                    std::task::Poll::Pending => return std::task::Poll::Pending,
1621                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1622                        this.is_terminated = true;
1623                        return std::task::Poll::Ready(None);
1624                    }
1625                    std::task::Poll::Ready(Err(e)) => {
1626                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1627                            e.into(),
1628                        ))))
1629                    }
1630                }
1631
1632                // A message has been received from the channel
1633                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1634
1635                std::task::Poll::Ready(Some(match header.ordinal {
1636                    0xde9b6ccbe936631 => {
1637                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1638                        let mut req = fidl::new_empty!(
1639                            StartOptions,
1640                            fidl::encoding::DefaultFuchsiaResourceDialect
1641                        );
1642                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StartOptions>(&header, _body_bytes, handles, &mut req)?;
1643                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
1644                        Ok(SessionRequest::StartTracing {
1645                            payload: req,
1646                            responder: SessionStartTracingResponder {
1647                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1648                                tx_id: header.tx_id,
1649                            },
1650                        })
1651                    }
1652                    0x50fefc9b3ff9b03a => {
1653                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1654                        let mut req = fidl::new_empty!(
1655                            StopOptions,
1656                            fidl::encoding::DefaultFuchsiaResourceDialect
1657                        );
1658                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StopOptions>(&header, _body_bytes, handles, &mut req)?;
1659                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
1660                        Ok(SessionRequest::StopTracing {
1661                            payload: req,
1662                            responder: SessionStopTracingResponder {
1663                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1664                                tx_id: header.tx_id,
1665                            },
1666                        })
1667                    }
1668                    0x1f1c080716d92276 => {
1669                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1670                        let mut req = fidl::new_empty!(
1671                            fidl::encoding::EmptyPayload,
1672                            fidl::encoding::DefaultFuchsiaResourceDialect
1673                        );
1674                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1675                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
1676                        Ok(SessionRequest::WatchAlert {
1677                            responder: SessionWatchAlertResponder {
1678                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1679                                tx_id: header.tx_id,
1680                            },
1681                        })
1682                    }
1683                    _ if header.tx_id == 0
1684                        && header
1685                            .dynamic_flags()
1686                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1687                    {
1688                        Ok(SessionRequest::_UnknownMethod {
1689                            ordinal: header.ordinal,
1690                            control_handle: SessionControlHandle { inner: this.inner.clone() },
1691                            method_type: fidl::MethodType::OneWay,
1692                        })
1693                    }
1694                    _ if header
1695                        .dynamic_flags()
1696                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1697                    {
1698                        this.inner.send_framework_err(
1699                            fidl::encoding::FrameworkErr::UnknownMethod,
1700                            header.tx_id,
1701                            header.ordinal,
1702                            header.dynamic_flags(),
1703                            (bytes, handles),
1704                        )?;
1705                        Ok(SessionRequest::_UnknownMethod {
1706                            ordinal: header.ordinal,
1707                            control_handle: SessionControlHandle { inner: this.inner.clone() },
1708                            method_type: fidl::MethodType::TwoWay,
1709                        })
1710                    }
1711                    _ => Err(fidl::Error::UnknownOrdinal {
1712                        ordinal: header.ordinal,
1713                        protocol_name:
1714                            <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1715                    }),
1716                }))
1717            },
1718        )
1719    }
1720}
1721
1722/// The session interface used by the trace tool to start/stop/terminate a trace Session.
1723///
1724/// The trace Session may lightly validate the structure of
1725/// trace records as it copies them from trace buffers into the output.
1726/// In particular, it may verify the size of each record header to ensure
1727/// that the framing of trace records in the data stream is maintained.
1728///
1729/// The trace Session does not validate the contents of the trace records
1730/// themselves.  For example, it does not try to check argument lengths in
1731/// events.  This ensures that the trace format can be extended without needing
1732/// to modify the trace Session.
1733///
1734/// The trace Session must be initialized from the provisioner. It can then be
1735/// used to start/stop tracing as many times as needed. Dropping the Session
1736/// will terminate tracing.
1737#[derive(Debug)]
1738pub enum SessionRequest {
1739    /// Requests to start tracing with the specified `options`.
1740    ///
1741    /// If tracing has already started then the request is ignored,
1742    /// except to send back an error code.
1743    ///
1744    /// The trace Session acknowledges the request when all
1745    /// registered providers have been started or after
1746    /// `TraceConfig.start_timeout_milliseconds` milliseconds.
1747    /// One useful reason for the has-started acknowledgement is that the
1748    /// trace program can start a program to trace knowing that all the
1749    /// providers are started.
1750    StartTracing { payload: StartOptions, responder: SessionStartTracingResponder },
1751    /// Requests to stop tracing.
1752    ///
1753    /// If tracing has already stopped then this does nothing.
1754    /// Returning a result lets callers know when it's ok to, for example,
1755    /// start tracing again.
1756    StopTracing { payload: StopOptions, responder: SessionStopTracingResponder },
1757    /// Returns the next alert when it arrives.
1758    ///
1759    /// Alerts received by the Session are queued until a WatchAlert
1760    /// request is received. Alerts are sent to the caller in the order
1761    /// they were received.
1762    ///
1763    /// WatchAlert requests are also queued until an alert is received
1764    /// and the requests are serviced in the order they were received.
1765    WatchAlert { responder: SessionWatchAlertResponder },
1766    /// An interaction was received which does not match any known method.
1767    #[non_exhaustive]
1768    _UnknownMethod {
1769        /// Ordinal of the method that was called.
1770        ordinal: u64,
1771        control_handle: SessionControlHandle,
1772        method_type: fidl::MethodType,
1773    },
1774}
1775
1776impl SessionRequest {
1777    #[allow(irrefutable_let_patterns)]
1778    pub fn into_start_tracing(self) -> Option<(StartOptions, SessionStartTracingResponder)> {
1779        if let SessionRequest::StartTracing { payload, responder } = self {
1780            Some((payload, responder))
1781        } else {
1782            None
1783        }
1784    }
1785
1786    #[allow(irrefutable_let_patterns)]
1787    pub fn into_stop_tracing(self) -> Option<(StopOptions, SessionStopTracingResponder)> {
1788        if let SessionRequest::StopTracing { payload, responder } = self {
1789            Some((payload, responder))
1790        } else {
1791            None
1792        }
1793    }
1794
1795    #[allow(irrefutable_let_patterns)]
1796    pub fn into_watch_alert(self) -> Option<(SessionWatchAlertResponder)> {
1797        if let SessionRequest::WatchAlert { responder } = self {
1798            Some((responder))
1799        } else {
1800            None
1801        }
1802    }
1803
1804    /// Name of the method defined in FIDL
1805    pub fn method_name(&self) -> &'static str {
1806        match *self {
1807            SessionRequest::StartTracing { .. } => "start_tracing",
1808            SessionRequest::StopTracing { .. } => "stop_tracing",
1809            SessionRequest::WatchAlert { .. } => "watch_alert",
1810            SessionRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1811                "unknown one-way method"
1812            }
1813            SessionRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1814                "unknown two-way method"
1815            }
1816        }
1817    }
1818}
1819
1820#[derive(Debug, Clone)]
1821pub struct SessionControlHandle {
1822    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1823}
1824
1825impl fidl::endpoints::ControlHandle for SessionControlHandle {
1826    fn shutdown(&self) {
1827        self.inner.shutdown()
1828    }
1829    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1830        self.inner.shutdown_with_epitaph(status)
1831    }
1832
1833    fn is_closed(&self) -> bool {
1834        self.inner.channel().is_closed()
1835    }
1836    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1837        self.inner.channel().on_closed()
1838    }
1839
1840    #[cfg(target_os = "fuchsia")]
1841    fn signal_peer(
1842        &self,
1843        clear_mask: zx::Signals,
1844        set_mask: zx::Signals,
1845    ) -> Result<(), zx_status::Status> {
1846        use fidl::Peered;
1847        self.inner.channel().signal_peer(clear_mask, set_mask)
1848    }
1849}
1850
1851impl SessionControlHandle {
1852    pub fn send_on_session_state_change(&self, mut state: SessionState) -> Result<(), fidl::Error> {
1853        self.inner.send::<SessionOnSessionStateChangeRequest>(
1854            (state,),
1855            0,
1856            0x7ab1640718b971cd,
1857            fidl::encoding::DynamicFlags::FLEXIBLE,
1858        )
1859    }
1860}
1861
1862#[must_use = "FIDL methods require a response to be sent"]
1863#[derive(Debug)]
1864pub struct SessionStartTracingResponder {
1865    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
1866    tx_id: u32,
1867}
1868
1869/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
1870/// if the responder is dropped without sending a response, so that the client
1871/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1872impl std::ops::Drop for SessionStartTracingResponder {
1873    fn drop(&mut self) {
1874        self.control_handle.shutdown();
1875        // Safety: drops once, never accessed again
1876        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1877    }
1878}
1879
1880impl fidl::endpoints::Responder for SessionStartTracingResponder {
1881    type ControlHandle = SessionControlHandle;
1882
1883    fn control_handle(&self) -> &SessionControlHandle {
1884        &self.control_handle
1885    }
1886
1887    fn drop_without_shutdown(mut self) {
1888        // Safety: drops once, never accessed again due to mem::forget
1889        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1890        // Prevent Drop from running (which would shut down the channel)
1891        std::mem::forget(self);
1892    }
1893}
1894
1895impl SessionStartTracingResponder {
1896    /// Sends a response to the FIDL transaction.
1897    ///
1898    /// Sets the channel to shutdown if an error occurs.
1899    pub fn send(self, mut result: Result<(), StartError>) -> Result<(), fidl::Error> {
1900        let _result = self.send_raw(result);
1901        if _result.is_err() {
1902            self.control_handle.shutdown();
1903        }
1904        self.drop_without_shutdown();
1905        _result
1906    }
1907
1908    /// Similar to "send" but does not shutdown the channel if an error occurs.
1909    pub fn send_no_shutdown_on_err(
1910        self,
1911        mut result: Result<(), StartError>,
1912    ) -> Result<(), fidl::Error> {
1913        let _result = self.send_raw(result);
1914        self.drop_without_shutdown();
1915        _result
1916    }
1917
1918    fn send_raw(&self, mut result: Result<(), StartError>) -> Result<(), fidl::Error> {
1919        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1920            fidl::encoding::EmptyStruct,
1921            StartError,
1922        >>(
1923            fidl::encoding::FlexibleResult::new(result),
1924            self.tx_id,
1925            0xde9b6ccbe936631,
1926            fidl::encoding::DynamicFlags::FLEXIBLE,
1927        )
1928    }
1929}
1930
1931#[must_use = "FIDL methods require a response to be sent"]
1932#[derive(Debug)]
1933pub struct SessionStopTracingResponder {
1934    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
1935    tx_id: u32,
1936}
1937
1938/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
1939/// if the responder is dropped without sending a response, so that the client
1940/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1941impl std::ops::Drop for SessionStopTracingResponder {
1942    fn drop(&mut self) {
1943        self.control_handle.shutdown();
1944        // Safety: drops once, never accessed again
1945        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1946    }
1947}
1948
1949impl fidl::endpoints::Responder for SessionStopTracingResponder {
1950    type ControlHandle = SessionControlHandle;
1951
1952    fn control_handle(&self) -> &SessionControlHandle {
1953        &self.control_handle
1954    }
1955
1956    fn drop_without_shutdown(mut self) {
1957        // Safety: drops once, never accessed again due to mem::forget
1958        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1959        // Prevent Drop from running (which would shut down the channel)
1960        std::mem::forget(self);
1961    }
1962}
1963
1964impl SessionStopTracingResponder {
1965    /// Sends a response to the FIDL transaction.
1966    ///
1967    /// Sets the channel to shutdown if an error occurs.
1968    pub fn send(self, mut result: Result<&StopResult, StopError>) -> Result<(), fidl::Error> {
1969        let _result = self.send_raw(result);
1970        if _result.is_err() {
1971            self.control_handle.shutdown();
1972        }
1973        self.drop_without_shutdown();
1974        _result
1975    }
1976
1977    /// Similar to "send" but does not shutdown the channel if an error occurs.
1978    pub fn send_no_shutdown_on_err(
1979        self,
1980        mut result: Result<&StopResult, StopError>,
1981    ) -> Result<(), fidl::Error> {
1982        let _result = self.send_raw(result);
1983        self.drop_without_shutdown();
1984        _result
1985    }
1986
1987    fn send_raw(&self, mut result: Result<&StopResult, StopError>) -> Result<(), fidl::Error> {
1988        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<StopResult, StopError>>(
1989            fidl::encoding::FlexibleResult::new(result),
1990            self.tx_id,
1991            0x50fefc9b3ff9b03a,
1992            fidl::encoding::DynamicFlags::FLEXIBLE,
1993        )
1994    }
1995}
1996
1997#[must_use = "FIDL methods require a response to be sent"]
1998#[derive(Debug)]
1999pub struct SessionWatchAlertResponder {
2000    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
2001    tx_id: u32,
2002}
2003
2004/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
2005/// if the responder is dropped without sending a response, so that the client
2006/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2007impl std::ops::Drop for SessionWatchAlertResponder {
2008    fn drop(&mut self) {
2009        self.control_handle.shutdown();
2010        // Safety: drops once, never accessed again
2011        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2012    }
2013}
2014
2015impl fidl::endpoints::Responder for SessionWatchAlertResponder {
2016    type ControlHandle = SessionControlHandle;
2017
2018    fn control_handle(&self) -> &SessionControlHandle {
2019        &self.control_handle
2020    }
2021
2022    fn drop_without_shutdown(mut self) {
2023        // Safety: drops once, never accessed again due to mem::forget
2024        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2025        // Prevent Drop from running (which would shut down the channel)
2026        std::mem::forget(self);
2027    }
2028}
2029
2030impl SessionWatchAlertResponder {
2031    /// Sends a response to the FIDL transaction.
2032    ///
2033    /// Sets the channel to shutdown if an error occurs.
2034    pub fn send(self, mut alert_name: &str) -> Result<(), fidl::Error> {
2035        let _result = self.send_raw(alert_name);
2036        if _result.is_err() {
2037            self.control_handle.shutdown();
2038        }
2039        self.drop_without_shutdown();
2040        _result
2041    }
2042
2043    /// Similar to "send" but does not shutdown the channel if an error occurs.
2044    pub fn send_no_shutdown_on_err(self, mut alert_name: &str) -> Result<(), fidl::Error> {
2045        let _result = self.send_raw(alert_name);
2046        self.drop_without_shutdown();
2047        _result
2048    }
2049
2050    fn send_raw(&self, mut alert_name: &str) -> Result<(), fidl::Error> {
2051        self.control_handle.inner.send::<fidl::encoding::FlexibleType<SessionWatchAlertResponse>>(
2052            fidl::encoding::Flexible::new((alert_name,)),
2053            self.tx_id,
2054            0x1f1c080716d92276,
2055            fidl::encoding::DynamicFlags::FLEXIBLE,
2056        )
2057    }
2058}
2059
2060mod internal {
2061    use super::*;
2062    unsafe impl fidl::encoding::TypeMarker for SessionState {
2063        type Owned = Self;
2064
2065        #[inline(always)]
2066        fn inline_align(_context: fidl::encoding::Context) -> usize {
2067            std::mem::align_of::<u32>()
2068        }
2069
2070        #[inline(always)]
2071        fn inline_size(_context: fidl::encoding::Context) -> usize {
2072            std::mem::size_of::<u32>()
2073        }
2074
2075        #[inline(always)]
2076        fn encode_is_copy() -> bool {
2077            false
2078        }
2079
2080        #[inline(always)]
2081        fn decode_is_copy() -> bool {
2082            false
2083        }
2084    }
2085
2086    impl fidl::encoding::ValueTypeMarker for SessionState {
2087        type Borrowed<'a> = Self;
2088        #[inline(always)]
2089        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2090            *value
2091        }
2092    }
2093
2094    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for SessionState {
2095        #[inline]
2096        unsafe fn encode(
2097            self,
2098            encoder: &mut fidl::encoding::Encoder<'_, D>,
2099            offset: usize,
2100            _depth: fidl::encoding::Depth,
2101        ) -> fidl::Result<()> {
2102            encoder.debug_check_bounds::<Self>(offset);
2103            encoder.write_num(self.into_primitive(), offset);
2104            Ok(())
2105        }
2106    }
2107
2108    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SessionState {
2109        #[inline(always)]
2110        fn new_empty() -> Self {
2111            Self::unknown()
2112        }
2113
2114        #[inline]
2115        unsafe fn decode(
2116            &mut self,
2117            decoder: &mut fidl::encoding::Decoder<'_, D>,
2118            offset: usize,
2119            _depth: fidl::encoding::Depth,
2120        ) -> fidl::Result<()> {
2121            decoder.debug_check_bounds::<Self>(offset);
2122            let prim = decoder.read_num::<u32>(offset);
2123
2124            *self = Self::from_primitive_allow_unknown(prim);
2125            Ok(())
2126        }
2127    }
2128    unsafe impl fidl::encoding::TypeMarker for StartError {
2129        type Owned = Self;
2130
2131        #[inline(always)]
2132        fn inline_align(_context: fidl::encoding::Context) -> usize {
2133            std::mem::align_of::<u32>()
2134        }
2135
2136        #[inline(always)]
2137        fn inline_size(_context: fidl::encoding::Context) -> usize {
2138            std::mem::size_of::<u32>()
2139        }
2140
2141        #[inline(always)]
2142        fn encode_is_copy() -> bool {
2143            false
2144        }
2145
2146        #[inline(always)]
2147        fn decode_is_copy() -> bool {
2148            false
2149        }
2150    }
2151
2152    impl fidl::encoding::ValueTypeMarker for StartError {
2153        type Borrowed<'a> = Self;
2154        #[inline(always)]
2155        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2156            *value
2157        }
2158    }
2159
2160    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for StartError {
2161        #[inline]
2162        unsafe fn encode(
2163            self,
2164            encoder: &mut fidl::encoding::Encoder<'_, D>,
2165            offset: usize,
2166            _depth: fidl::encoding::Depth,
2167        ) -> fidl::Result<()> {
2168            encoder.debug_check_bounds::<Self>(offset);
2169            encoder.write_num(self.into_primitive(), offset);
2170            Ok(())
2171        }
2172    }
2173
2174    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StartError {
2175        #[inline(always)]
2176        fn new_empty() -> Self {
2177            Self::unknown()
2178        }
2179
2180        #[inline]
2181        unsafe fn decode(
2182            &mut self,
2183            decoder: &mut fidl::encoding::Decoder<'_, D>,
2184            offset: usize,
2185            _depth: fidl::encoding::Depth,
2186        ) -> fidl::Result<()> {
2187            decoder.debug_check_bounds::<Self>(offset);
2188            let prim = decoder.read_num::<u32>(offset);
2189
2190            *self = Self::from_primitive_allow_unknown(prim);
2191            Ok(())
2192        }
2193    }
2194    unsafe impl fidl::encoding::TypeMarker for StopError {
2195        type Owned = Self;
2196
2197        #[inline(always)]
2198        fn inline_align(_context: fidl::encoding::Context) -> usize {
2199            std::mem::align_of::<u32>()
2200        }
2201
2202        #[inline(always)]
2203        fn inline_size(_context: fidl::encoding::Context) -> usize {
2204            std::mem::size_of::<u32>()
2205        }
2206
2207        #[inline(always)]
2208        fn encode_is_copy() -> bool {
2209            false
2210        }
2211
2212        #[inline(always)]
2213        fn decode_is_copy() -> bool {
2214            false
2215        }
2216    }
2217
2218    impl fidl::encoding::ValueTypeMarker for StopError {
2219        type Borrowed<'a> = Self;
2220        #[inline(always)]
2221        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2222            *value
2223        }
2224    }
2225
2226    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for StopError {
2227        #[inline]
2228        unsafe fn encode(
2229            self,
2230            encoder: &mut fidl::encoding::Encoder<'_, D>,
2231            offset: usize,
2232            _depth: fidl::encoding::Depth,
2233        ) -> fidl::Result<()> {
2234            encoder.debug_check_bounds::<Self>(offset);
2235            encoder.write_num(self.into_primitive(), offset);
2236            Ok(())
2237        }
2238    }
2239
2240    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StopError {
2241        #[inline(always)]
2242        fn new_empty() -> Self {
2243            Self::unknown()
2244        }
2245
2246        #[inline]
2247        unsafe fn decode(
2248            &mut self,
2249            decoder: &mut fidl::encoding::Decoder<'_, D>,
2250            offset: usize,
2251            _depth: fidl::encoding::Depth,
2252        ) -> fidl::Result<()> {
2253            decoder.debug_check_bounds::<Self>(offset);
2254            let prim = decoder.read_num::<u32>(offset);
2255
2256            *self = Self::from_primitive_allow_unknown(prim);
2257            Ok(())
2258        }
2259    }
2260
2261    impl fidl::encoding::ResourceTypeMarker for ProvisionerInitializeTracingRequest {
2262        type Borrowed<'a> = &'a mut Self;
2263        fn take_or_borrow<'a>(
2264            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2265        ) -> Self::Borrowed<'a> {
2266            value
2267        }
2268    }
2269
2270    unsafe impl fidl::encoding::TypeMarker for ProvisionerInitializeTracingRequest {
2271        type Owned = Self;
2272
2273        #[inline(always)]
2274        fn inline_align(_context: fidl::encoding::Context) -> usize {
2275            8
2276        }
2277
2278        #[inline(always)]
2279        fn inline_size(_context: fidl::encoding::Context) -> usize {
2280            32
2281        }
2282    }
2283
2284    unsafe impl
2285        fidl::encoding::Encode<
2286            ProvisionerInitializeTracingRequest,
2287            fidl::encoding::DefaultFuchsiaResourceDialect,
2288        > for &mut ProvisionerInitializeTracingRequest
2289    {
2290        #[inline]
2291        unsafe fn encode(
2292            self,
2293            encoder: &mut fidl::encoding::Encoder<
2294                '_,
2295                fidl::encoding::DefaultFuchsiaResourceDialect,
2296            >,
2297            offset: usize,
2298            _depth: fidl::encoding::Depth,
2299        ) -> fidl::Result<()> {
2300            encoder.debug_check_bounds::<ProvisionerInitializeTracingRequest>(offset);
2301            // Delegate to tuple encoding.
2302            fidl::encoding::Encode::<ProvisionerInitializeTracingRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2303                (
2304                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.controller),
2305                    <TraceConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),
2306                    <fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16392> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.output),
2307                ),
2308                encoder, offset, _depth
2309            )
2310        }
2311    }
2312    unsafe impl<
2313            T0: fidl::encoding::Encode<
2314                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
2315                fidl::encoding::DefaultFuchsiaResourceDialect,
2316            >,
2317            T1: fidl::encoding::Encode<TraceConfig, fidl::encoding::DefaultFuchsiaResourceDialect>,
2318            T2: fidl::encoding::Encode<
2319                fidl::encoding::HandleType<
2320                    fidl::Socket,
2321                    { fidl::ObjectType::SOCKET.into_raw() },
2322                    16392,
2323                >,
2324                fidl::encoding::DefaultFuchsiaResourceDialect,
2325            >,
2326        >
2327        fidl::encoding::Encode<
2328            ProvisionerInitializeTracingRequest,
2329            fidl::encoding::DefaultFuchsiaResourceDialect,
2330        > for (T0, T1, T2)
2331    {
2332        #[inline]
2333        unsafe fn encode(
2334            self,
2335            encoder: &mut fidl::encoding::Encoder<
2336                '_,
2337                fidl::encoding::DefaultFuchsiaResourceDialect,
2338            >,
2339            offset: usize,
2340            depth: fidl::encoding::Depth,
2341        ) -> fidl::Result<()> {
2342            encoder.debug_check_bounds::<ProvisionerInitializeTracingRequest>(offset);
2343            // Zero out padding regions. There's no need to apply masks
2344            // because the unmasked parts will be overwritten by fields.
2345            unsafe {
2346                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2347                (ptr as *mut u64).write_unaligned(0);
2348            }
2349            unsafe {
2350                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
2351                (ptr as *mut u64).write_unaligned(0);
2352            }
2353            // Write the fields.
2354            self.0.encode(encoder, offset + 0, depth)?;
2355            self.1.encode(encoder, offset + 8, depth)?;
2356            self.2.encode(encoder, offset + 24, depth)?;
2357            Ok(())
2358        }
2359    }
2360
2361    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2362        for ProvisionerInitializeTracingRequest
2363    {
2364        #[inline(always)]
2365        fn new_empty() -> Self {
2366            Self {
2367                controller: fidl::new_empty!(
2368                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
2369                    fidl::encoding::DefaultFuchsiaResourceDialect
2370                ),
2371                config: fidl::new_empty!(
2372                    TraceConfig,
2373                    fidl::encoding::DefaultFuchsiaResourceDialect
2374                ),
2375                output: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16392>, fidl::encoding::DefaultFuchsiaResourceDialect),
2376            }
2377        }
2378
2379        #[inline]
2380        unsafe fn decode(
2381            &mut self,
2382            decoder: &mut fidl::encoding::Decoder<
2383                '_,
2384                fidl::encoding::DefaultFuchsiaResourceDialect,
2385            >,
2386            offset: usize,
2387            _depth: fidl::encoding::Depth,
2388        ) -> fidl::Result<()> {
2389            decoder.debug_check_bounds::<Self>(offset);
2390            // Verify that padding bytes are zero.
2391            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2392            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2393            let mask = 0xffffffff00000000u64;
2394            let maskedval = padval & mask;
2395            if maskedval != 0 {
2396                return Err(fidl::Error::NonZeroPadding {
2397                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2398                });
2399            }
2400            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
2401            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2402            let mask = 0xffffffff00000000u64;
2403            let maskedval = padval & mask;
2404            if maskedval != 0 {
2405                return Err(fidl::Error::NonZeroPadding {
2406                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
2407                });
2408            }
2409            fidl::decode!(
2410                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
2411                fidl::encoding::DefaultFuchsiaResourceDialect,
2412                &mut self.controller,
2413                decoder,
2414                offset + 0,
2415                _depth
2416            )?;
2417            fidl::decode!(
2418                TraceConfig,
2419                fidl::encoding::DefaultFuchsiaResourceDialect,
2420                &mut self.config,
2421                decoder,
2422                offset + 8,
2423                _depth
2424            )?;
2425            fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16392>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.output, decoder, offset + 24, _depth)?;
2426            Ok(())
2427        }
2428    }
2429
2430    impl fidl::encoding::ValueTypeMarker for ProvisionerGetKnownCategoriesResponse {
2431        type Borrowed<'a> = &'a Self;
2432        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2433            value
2434        }
2435    }
2436
2437    unsafe impl fidl::encoding::TypeMarker for ProvisionerGetKnownCategoriesResponse {
2438        type Owned = Self;
2439
2440        #[inline(always)]
2441        fn inline_align(_context: fidl::encoding::Context) -> usize {
2442            8
2443        }
2444
2445        #[inline(always)]
2446        fn inline_size(_context: fidl::encoding::Context) -> usize {
2447            16
2448        }
2449    }
2450
2451    unsafe impl<D: fidl::encoding::ResourceDialect>
2452        fidl::encoding::Encode<ProvisionerGetKnownCategoriesResponse, D>
2453        for &ProvisionerGetKnownCategoriesResponse
2454    {
2455        #[inline]
2456        unsafe fn encode(
2457            self,
2458            encoder: &mut fidl::encoding::Encoder<'_, D>,
2459            offset: usize,
2460            _depth: fidl::encoding::Depth,
2461        ) -> fidl::Result<()> {
2462            encoder.debug_check_bounds::<ProvisionerGetKnownCategoriesResponse>(offset);
2463            // Delegate to tuple encoding.
2464            fidl::encoding::Encode::<ProvisionerGetKnownCategoriesResponse, D>::encode(
2465                (
2466                    <fidl::encoding::Vector<fidl_fuchsia_tracing::KnownCategory, 5000> as fidl::encoding::ValueTypeMarker>::borrow(&self.categories),
2467                ),
2468                encoder, offset, _depth
2469            )
2470        }
2471    }
2472    unsafe impl<
2473            D: fidl::encoding::ResourceDialect,
2474            T0: fidl::encoding::Encode<
2475                fidl::encoding::Vector<fidl_fuchsia_tracing::KnownCategory, 5000>,
2476                D,
2477            >,
2478        > fidl::encoding::Encode<ProvisionerGetKnownCategoriesResponse, D> for (T0,)
2479    {
2480        #[inline]
2481        unsafe fn encode(
2482            self,
2483            encoder: &mut fidl::encoding::Encoder<'_, D>,
2484            offset: usize,
2485            depth: fidl::encoding::Depth,
2486        ) -> fidl::Result<()> {
2487            encoder.debug_check_bounds::<ProvisionerGetKnownCategoriesResponse>(offset);
2488            // Zero out padding regions. There's no need to apply masks
2489            // because the unmasked parts will be overwritten by fields.
2490            // Write the fields.
2491            self.0.encode(encoder, offset + 0, depth)?;
2492            Ok(())
2493        }
2494    }
2495
2496    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2497        for ProvisionerGetKnownCategoriesResponse
2498    {
2499        #[inline(always)]
2500        fn new_empty() -> Self {
2501            Self {
2502                categories: fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_tracing::KnownCategory, 5000>, D),
2503            }
2504        }
2505
2506        #[inline]
2507        unsafe fn decode(
2508            &mut self,
2509            decoder: &mut fidl::encoding::Decoder<'_, D>,
2510            offset: usize,
2511            _depth: fidl::encoding::Depth,
2512        ) -> fidl::Result<()> {
2513            decoder.debug_check_bounds::<Self>(offset);
2514            // Verify that padding bytes are zero.
2515            fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_tracing::KnownCategory, 5000>, D, &mut self.categories, decoder, offset + 0, _depth)?;
2516            Ok(())
2517        }
2518    }
2519
2520    impl fidl::encoding::ValueTypeMarker for ProvisionerGetProvidersResponse {
2521        type Borrowed<'a> = &'a Self;
2522        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2523            value
2524        }
2525    }
2526
2527    unsafe impl fidl::encoding::TypeMarker for ProvisionerGetProvidersResponse {
2528        type Owned = Self;
2529
2530        #[inline(always)]
2531        fn inline_align(_context: fidl::encoding::Context) -> usize {
2532            8
2533        }
2534
2535        #[inline(always)]
2536        fn inline_size(_context: fidl::encoding::Context) -> usize {
2537            16
2538        }
2539    }
2540
2541    unsafe impl<D: fidl::encoding::ResourceDialect>
2542        fidl::encoding::Encode<ProvisionerGetProvidersResponse, D>
2543        for &ProvisionerGetProvidersResponse
2544    {
2545        #[inline]
2546        unsafe fn encode(
2547            self,
2548            encoder: &mut fidl::encoding::Encoder<'_, D>,
2549            offset: usize,
2550            _depth: fidl::encoding::Depth,
2551        ) -> fidl::Result<()> {
2552            encoder.debug_check_bounds::<ProvisionerGetProvidersResponse>(offset);
2553            // Delegate to tuple encoding.
2554            fidl::encoding::Encode::<ProvisionerGetProvidersResponse, D>::encode(
2555                (
2556                    <fidl::encoding::Vector<ProviderInfo, 100> as fidl::encoding::ValueTypeMarker>::borrow(&self.providers),
2557                ),
2558                encoder, offset, _depth
2559            )
2560        }
2561    }
2562    unsafe impl<
2563            D: fidl::encoding::ResourceDialect,
2564            T0: fidl::encoding::Encode<fidl::encoding::Vector<ProviderInfo, 100>, D>,
2565        > fidl::encoding::Encode<ProvisionerGetProvidersResponse, D> for (T0,)
2566    {
2567        #[inline]
2568        unsafe fn encode(
2569            self,
2570            encoder: &mut fidl::encoding::Encoder<'_, D>,
2571            offset: usize,
2572            depth: fidl::encoding::Depth,
2573        ) -> fidl::Result<()> {
2574            encoder.debug_check_bounds::<ProvisionerGetProvidersResponse>(offset);
2575            // Zero out padding regions. There's no need to apply masks
2576            // because the unmasked parts will be overwritten by fields.
2577            // Write the fields.
2578            self.0.encode(encoder, offset + 0, depth)?;
2579            Ok(())
2580        }
2581    }
2582
2583    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2584        for ProvisionerGetProvidersResponse
2585    {
2586        #[inline(always)]
2587        fn new_empty() -> Self {
2588            Self { providers: fidl::new_empty!(fidl::encoding::Vector<ProviderInfo, 100>, D) }
2589        }
2590
2591        #[inline]
2592        unsafe fn decode(
2593            &mut self,
2594            decoder: &mut fidl::encoding::Decoder<'_, D>,
2595            offset: usize,
2596            _depth: fidl::encoding::Depth,
2597        ) -> fidl::Result<()> {
2598            decoder.debug_check_bounds::<Self>(offset);
2599            // Verify that padding bytes are zero.
2600            fidl::decode!(fidl::encoding::Vector<ProviderInfo, 100>, D, &mut self.providers, decoder, offset + 0, _depth)?;
2601            Ok(())
2602        }
2603    }
2604
2605    impl fidl::encoding::ValueTypeMarker for SessionOnSessionStateChangeRequest {
2606        type Borrowed<'a> = &'a Self;
2607        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2608            value
2609        }
2610    }
2611
2612    unsafe impl fidl::encoding::TypeMarker for SessionOnSessionStateChangeRequest {
2613        type Owned = Self;
2614
2615        #[inline(always)]
2616        fn inline_align(_context: fidl::encoding::Context) -> usize {
2617            4
2618        }
2619
2620        #[inline(always)]
2621        fn inline_size(_context: fidl::encoding::Context) -> usize {
2622            4
2623        }
2624    }
2625
2626    unsafe impl<D: fidl::encoding::ResourceDialect>
2627        fidl::encoding::Encode<SessionOnSessionStateChangeRequest, D>
2628        for &SessionOnSessionStateChangeRequest
2629    {
2630        #[inline]
2631        unsafe fn encode(
2632            self,
2633            encoder: &mut fidl::encoding::Encoder<'_, D>,
2634            offset: usize,
2635            _depth: fidl::encoding::Depth,
2636        ) -> fidl::Result<()> {
2637            encoder.debug_check_bounds::<SessionOnSessionStateChangeRequest>(offset);
2638            // Delegate to tuple encoding.
2639            fidl::encoding::Encode::<SessionOnSessionStateChangeRequest, D>::encode(
2640                (<SessionState as fidl::encoding::ValueTypeMarker>::borrow(&self.state),),
2641                encoder,
2642                offset,
2643                _depth,
2644            )
2645        }
2646    }
2647    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<SessionState, D>>
2648        fidl::encoding::Encode<SessionOnSessionStateChangeRequest, D> for (T0,)
2649    {
2650        #[inline]
2651        unsafe fn encode(
2652            self,
2653            encoder: &mut fidl::encoding::Encoder<'_, D>,
2654            offset: usize,
2655            depth: fidl::encoding::Depth,
2656        ) -> fidl::Result<()> {
2657            encoder.debug_check_bounds::<SessionOnSessionStateChangeRequest>(offset);
2658            // Zero out padding regions. There's no need to apply masks
2659            // because the unmasked parts will be overwritten by fields.
2660            // Write the fields.
2661            self.0.encode(encoder, offset + 0, depth)?;
2662            Ok(())
2663        }
2664    }
2665
2666    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2667        for SessionOnSessionStateChangeRequest
2668    {
2669        #[inline(always)]
2670        fn new_empty() -> Self {
2671            Self { state: fidl::new_empty!(SessionState, D) }
2672        }
2673
2674        #[inline]
2675        unsafe fn decode(
2676            &mut self,
2677            decoder: &mut fidl::encoding::Decoder<'_, D>,
2678            offset: usize,
2679            _depth: fidl::encoding::Depth,
2680        ) -> fidl::Result<()> {
2681            decoder.debug_check_bounds::<Self>(offset);
2682            // Verify that padding bytes are zero.
2683            fidl::decode!(SessionState, D, &mut self.state, decoder, offset + 0, _depth)?;
2684            Ok(())
2685        }
2686    }
2687
2688    impl fidl::encoding::ValueTypeMarker for SessionWatchAlertResponse {
2689        type Borrowed<'a> = &'a Self;
2690        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2691            value
2692        }
2693    }
2694
2695    unsafe impl fidl::encoding::TypeMarker for SessionWatchAlertResponse {
2696        type Owned = Self;
2697
2698        #[inline(always)]
2699        fn inline_align(_context: fidl::encoding::Context) -> usize {
2700            8
2701        }
2702
2703        #[inline(always)]
2704        fn inline_size(_context: fidl::encoding::Context) -> usize {
2705            16
2706        }
2707    }
2708
2709    unsafe impl<D: fidl::encoding::ResourceDialect>
2710        fidl::encoding::Encode<SessionWatchAlertResponse, D> for &SessionWatchAlertResponse
2711    {
2712        #[inline]
2713        unsafe fn encode(
2714            self,
2715            encoder: &mut fidl::encoding::Encoder<'_, D>,
2716            offset: usize,
2717            _depth: fidl::encoding::Depth,
2718        ) -> fidl::Result<()> {
2719            encoder.debug_check_bounds::<SessionWatchAlertResponse>(offset);
2720            // Delegate to tuple encoding.
2721            fidl::encoding::Encode::<SessionWatchAlertResponse, D>::encode(
2722                (<fidl::encoding::BoundedString<14> as fidl::encoding::ValueTypeMarker>::borrow(
2723                    &self.alert_name,
2724                ),),
2725                encoder,
2726                offset,
2727                _depth,
2728            )
2729        }
2730    }
2731    unsafe impl<
2732            D: fidl::encoding::ResourceDialect,
2733            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<14>, D>,
2734        > fidl::encoding::Encode<SessionWatchAlertResponse, D> for (T0,)
2735    {
2736        #[inline]
2737        unsafe fn encode(
2738            self,
2739            encoder: &mut fidl::encoding::Encoder<'_, D>,
2740            offset: usize,
2741            depth: fidl::encoding::Depth,
2742        ) -> fidl::Result<()> {
2743            encoder.debug_check_bounds::<SessionWatchAlertResponse>(offset);
2744            // Zero out padding regions. There's no need to apply masks
2745            // because the unmasked parts will be overwritten by fields.
2746            // Write the fields.
2747            self.0.encode(encoder, offset + 0, depth)?;
2748            Ok(())
2749        }
2750    }
2751
2752    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2753        for SessionWatchAlertResponse
2754    {
2755        #[inline(always)]
2756        fn new_empty() -> Self {
2757            Self { alert_name: fidl::new_empty!(fidl::encoding::BoundedString<14>, D) }
2758        }
2759
2760        #[inline]
2761        unsafe fn decode(
2762            &mut self,
2763            decoder: &mut fidl::encoding::Decoder<'_, D>,
2764            offset: usize,
2765            _depth: fidl::encoding::Depth,
2766        ) -> fidl::Result<()> {
2767            decoder.debug_check_bounds::<Self>(offset);
2768            // Verify that padding bytes are zero.
2769            fidl::decode!(
2770                fidl::encoding::BoundedString<14>,
2771                D,
2772                &mut self.alert_name,
2773                decoder,
2774                offset + 0,
2775                _depth
2776            )?;
2777            Ok(())
2778        }
2779    }
2780
2781    impl FxtVersion {
2782        #[inline(always)]
2783        fn max_ordinal_present(&self) -> u64 {
2784            if let Some(_) = self.minor {
2785                return 2;
2786            }
2787            if let Some(_) = self.major {
2788                return 1;
2789            }
2790            0
2791        }
2792    }
2793
2794    impl fidl::encoding::ValueTypeMarker for FxtVersion {
2795        type Borrowed<'a> = &'a Self;
2796        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2797            value
2798        }
2799    }
2800
2801    unsafe impl fidl::encoding::TypeMarker for FxtVersion {
2802        type Owned = Self;
2803
2804        #[inline(always)]
2805        fn inline_align(_context: fidl::encoding::Context) -> usize {
2806            8
2807        }
2808
2809        #[inline(always)]
2810        fn inline_size(_context: fidl::encoding::Context) -> usize {
2811            16
2812        }
2813    }
2814
2815    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FxtVersion, D>
2816        for &FxtVersion
2817    {
2818        unsafe fn encode(
2819            self,
2820            encoder: &mut fidl::encoding::Encoder<'_, D>,
2821            offset: usize,
2822            mut depth: fidl::encoding::Depth,
2823        ) -> fidl::Result<()> {
2824            encoder.debug_check_bounds::<FxtVersion>(offset);
2825            // Vector header
2826            let max_ordinal: u64 = self.max_ordinal_present();
2827            encoder.write_num(max_ordinal, offset);
2828            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2829            // Calling encoder.out_of_line_offset(0) is not allowed.
2830            if max_ordinal == 0 {
2831                return Ok(());
2832            }
2833            depth.increment()?;
2834            let envelope_size = 8;
2835            let bytes_len = max_ordinal as usize * envelope_size;
2836            #[allow(unused_variables)]
2837            let offset = encoder.out_of_line_offset(bytes_len);
2838            let mut _prev_end_offset: usize = 0;
2839            if 1 > max_ordinal {
2840                return Ok(());
2841            }
2842
2843            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2844            // are envelope_size bytes.
2845            let cur_offset: usize = (1 - 1) * envelope_size;
2846
2847            // Zero reserved fields.
2848            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2849
2850            // Safety:
2851            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2852            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2853            //   envelope_size bytes, there is always sufficient room.
2854            fidl::encoding::encode_in_envelope_optional::<u32, D>(
2855                self.major.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
2856                encoder,
2857                offset + cur_offset,
2858                depth,
2859            )?;
2860
2861            _prev_end_offset = cur_offset + envelope_size;
2862            if 2 > max_ordinal {
2863                return Ok(());
2864            }
2865
2866            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2867            // are envelope_size bytes.
2868            let cur_offset: usize = (2 - 1) * envelope_size;
2869
2870            // Zero reserved fields.
2871            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2872
2873            // Safety:
2874            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2875            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2876            //   envelope_size bytes, there is always sufficient room.
2877            fidl::encoding::encode_in_envelope_optional::<u32, D>(
2878                self.minor.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
2879                encoder,
2880                offset + cur_offset,
2881                depth,
2882            )?;
2883
2884            _prev_end_offset = cur_offset + envelope_size;
2885
2886            Ok(())
2887        }
2888    }
2889
2890    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FxtVersion {
2891        #[inline(always)]
2892        fn new_empty() -> Self {
2893            Self::default()
2894        }
2895
2896        unsafe fn decode(
2897            &mut self,
2898            decoder: &mut fidl::encoding::Decoder<'_, D>,
2899            offset: usize,
2900            mut depth: fidl::encoding::Depth,
2901        ) -> fidl::Result<()> {
2902            decoder.debug_check_bounds::<Self>(offset);
2903            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2904                None => return Err(fidl::Error::NotNullable),
2905                Some(len) => len,
2906            };
2907            // Calling decoder.out_of_line_offset(0) is not allowed.
2908            if len == 0 {
2909                return Ok(());
2910            };
2911            depth.increment()?;
2912            let envelope_size = 8;
2913            let bytes_len = len * envelope_size;
2914            let offset = decoder.out_of_line_offset(bytes_len)?;
2915            // Decode the envelope for each type.
2916            let mut _next_ordinal_to_read = 0;
2917            let mut next_offset = offset;
2918            let end_offset = offset + bytes_len;
2919            _next_ordinal_to_read += 1;
2920            if next_offset >= end_offset {
2921                return Ok(());
2922            }
2923
2924            // Decode unknown envelopes for gaps in ordinals.
2925            while _next_ordinal_to_read < 1 {
2926                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2927                _next_ordinal_to_read += 1;
2928                next_offset += envelope_size;
2929            }
2930
2931            let next_out_of_line = decoder.next_out_of_line();
2932            let handles_before = decoder.remaining_handles();
2933            if let Some((inlined, num_bytes, num_handles)) =
2934                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2935            {
2936                let member_inline_size =
2937                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2938                if inlined != (member_inline_size <= 4) {
2939                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2940                }
2941                let inner_offset;
2942                let mut inner_depth = depth.clone();
2943                if inlined {
2944                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2945                    inner_offset = next_offset;
2946                } else {
2947                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2948                    inner_depth.increment()?;
2949                }
2950                let val_ref = self.major.get_or_insert_with(|| fidl::new_empty!(u32, D));
2951                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
2952                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2953                {
2954                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2955                }
2956                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2957                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2958                }
2959            }
2960
2961            next_offset += envelope_size;
2962            _next_ordinal_to_read += 1;
2963            if next_offset >= end_offset {
2964                return Ok(());
2965            }
2966
2967            // Decode unknown envelopes for gaps in ordinals.
2968            while _next_ordinal_to_read < 2 {
2969                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2970                _next_ordinal_to_read += 1;
2971                next_offset += envelope_size;
2972            }
2973
2974            let next_out_of_line = decoder.next_out_of_line();
2975            let handles_before = decoder.remaining_handles();
2976            if let Some((inlined, num_bytes, num_handles)) =
2977                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2978            {
2979                let member_inline_size =
2980                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2981                if inlined != (member_inline_size <= 4) {
2982                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2983                }
2984                let inner_offset;
2985                let mut inner_depth = depth.clone();
2986                if inlined {
2987                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2988                    inner_offset = next_offset;
2989                } else {
2990                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2991                    inner_depth.increment()?;
2992                }
2993                let val_ref = self.minor.get_or_insert_with(|| fidl::new_empty!(u32, D));
2994                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
2995                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2996                {
2997                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2998                }
2999                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3000                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3001                }
3002            }
3003
3004            next_offset += envelope_size;
3005
3006            // Decode the remaining unknown envelopes.
3007            while next_offset < end_offset {
3008                _next_ordinal_to_read += 1;
3009                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3010                next_offset += envelope_size;
3011            }
3012
3013            Ok(())
3014        }
3015    }
3016
3017    impl ProviderInfo {
3018        #[inline(always)]
3019        fn max_ordinal_present(&self) -> u64 {
3020            if let Some(_) = self.name {
3021                return 3;
3022            }
3023            if let Some(_) = self.pid {
3024                return 2;
3025            }
3026            if let Some(_) = self.id {
3027                return 1;
3028            }
3029            0
3030        }
3031    }
3032
3033    impl fidl::encoding::ValueTypeMarker for ProviderInfo {
3034        type Borrowed<'a> = &'a Self;
3035        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3036            value
3037        }
3038    }
3039
3040    unsafe impl fidl::encoding::TypeMarker for ProviderInfo {
3041        type Owned = Self;
3042
3043        #[inline(always)]
3044        fn inline_align(_context: fidl::encoding::Context) -> usize {
3045            8
3046        }
3047
3048        #[inline(always)]
3049        fn inline_size(_context: fidl::encoding::Context) -> usize {
3050            16
3051        }
3052    }
3053
3054    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ProviderInfo, D>
3055        for &ProviderInfo
3056    {
3057        unsafe fn encode(
3058            self,
3059            encoder: &mut fidl::encoding::Encoder<'_, D>,
3060            offset: usize,
3061            mut depth: fidl::encoding::Depth,
3062        ) -> fidl::Result<()> {
3063            encoder.debug_check_bounds::<ProviderInfo>(offset);
3064            // Vector header
3065            let max_ordinal: u64 = self.max_ordinal_present();
3066            encoder.write_num(max_ordinal, offset);
3067            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3068            // Calling encoder.out_of_line_offset(0) is not allowed.
3069            if max_ordinal == 0 {
3070                return Ok(());
3071            }
3072            depth.increment()?;
3073            let envelope_size = 8;
3074            let bytes_len = max_ordinal as usize * envelope_size;
3075            #[allow(unused_variables)]
3076            let offset = encoder.out_of_line_offset(bytes_len);
3077            let mut _prev_end_offset: usize = 0;
3078            if 1 > max_ordinal {
3079                return Ok(());
3080            }
3081
3082            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3083            // are envelope_size bytes.
3084            let cur_offset: usize = (1 - 1) * envelope_size;
3085
3086            // Zero reserved fields.
3087            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3088
3089            // Safety:
3090            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3091            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3092            //   envelope_size bytes, there is always sufficient room.
3093            fidl::encoding::encode_in_envelope_optional::<u32, D>(
3094                self.id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3095                encoder,
3096                offset + cur_offset,
3097                depth,
3098            )?;
3099
3100            _prev_end_offset = cur_offset + envelope_size;
3101            if 2 > max_ordinal {
3102                return Ok(());
3103            }
3104
3105            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3106            // are envelope_size bytes.
3107            let cur_offset: usize = (2 - 1) * envelope_size;
3108
3109            // Zero reserved fields.
3110            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3111
3112            // Safety:
3113            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3114            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3115            //   envelope_size bytes, there is always sufficient room.
3116            fidl::encoding::encode_in_envelope_optional::<u64, D>(
3117                self.pid.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3118                encoder,
3119                offset + cur_offset,
3120                depth,
3121            )?;
3122
3123            _prev_end_offset = cur_offset + envelope_size;
3124            if 3 > max_ordinal {
3125                return Ok(());
3126            }
3127
3128            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3129            // are envelope_size bytes.
3130            let cur_offset: usize = (3 - 1) * envelope_size;
3131
3132            // Zero reserved fields.
3133            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3134
3135            // Safety:
3136            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3137            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3138            //   envelope_size bytes, there is always sufficient room.
3139            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<100>, D>(
3140                self.name.as_ref().map(
3141                    <fidl::encoding::BoundedString<100> as fidl::encoding::ValueTypeMarker>::borrow,
3142                ),
3143                encoder,
3144                offset + cur_offset,
3145                depth,
3146            )?;
3147
3148            _prev_end_offset = cur_offset + envelope_size;
3149
3150            Ok(())
3151        }
3152    }
3153
3154    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ProviderInfo {
3155        #[inline(always)]
3156        fn new_empty() -> Self {
3157            Self::default()
3158        }
3159
3160        unsafe fn decode(
3161            &mut self,
3162            decoder: &mut fidl::encoding::Decoder<'_, D>,
3163            offset: usize,
3164            mut depth: fidl::encoding::Depth,
3165        ) -> fidl::Result<()> {
3166            decoder.debug_check_bounds::<Self>(offset);
3167            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3168                None => return Err(fidl::Error::NotNullable),
3169                Some(len) => len,
3170            };
3171            // Calling decoder.out_of_line_offset(0) is not allowed.
3172            if len == 0 {
3173                return Ok(());
3174            };
3175            depth.increment()?;
3176            let envelope_size = 8;
3177            let bytes_len = len * envelope_size;
3178            let offset = decoder.out_of_line_offset(bytes_len)?;
3179            // Decode the envelope for each type.
3180            let mut _next_ordinal_to_read = 0;
3181            let mut next_offset = offset;
3182            let end_offset = offset + bytes_len;
3183            _next_ordinal_to_read += 1;
3184            if next_offset >= end_offset {
3185                return Ok(());
3186            }
3187
3188            // Decode unknown envelopes for gaps in ordinals.
3189            while _next_ordinal_to_read < 1 {
3190                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3191                _next_ordinal_to_read += 1;
3192                next_offset += envelope_size;
3193            }
3194
3195            let next_out_of_line = decoder.next_out_of_line();
3196            let handles_before = decoder.remaining_handles();
3197            if let Some((inlined, num_bytes, num_handles)) =
3198                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3199            {
3200                let member_inline_size =
3201                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3202                if inlined != (member_inline_size <= 4) {
3203                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3204                }
3205                let inner_offset;
3206                let mut inner_depth = depth.clone();
3207                if inlined {
3208                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3209                    inner_offset = next_offset;
3210                } else {
3211                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3212                    inner_depth.increment()?;
3213                }
3214                let val_ref = self.id.get_or_insert_with(|| fidl::new_empty!(u32, D));
3215                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
3216                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3217                {
3218                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3219                }
3220                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3221                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3222                }
3223            }
3224
3225            next_offset += envelope_size;
3226            _next_ordinal_to_read += 1;
3227            if next_offset >= end_offset {
3228                return Ok(());
3229            }
3230
3231            // Decode unknown envelopes for gaps in ordinals.
3232            while _next_ordinal_to_read < 2 {
3233                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3234                _next_ordinal_to_read += 1;
3235                next_offset += envelope_size;
3236            }
3237
3238            let next_out_of_line = decoder.next_out_of_line();
3239            let handles_before = decoder.remaining_handles();
3240            if let Some((inlined, num_bytes, num_handles)) =
3241                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3242            {
3243                let member_inline_size =
3244                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3245                if inlined != (member_inline_size <= 4) {
3246                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3247                }
3248                let inner_offset;
3249                let mut inner_depth = depth.clone();
3250                if inlined {
3251                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3252                    inner_offset = next_offset;
3253                } else {
3254                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3255                    inner_depth.increment()?;
3256                }
3257                let val_ref = self.pid.get_or_insert_with(|| fidl::new_empty!(u64, D));
3258                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
3259                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3260                {
3261                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3262                }
3263                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3264                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3265                }
3266            }
3267
3268            next_offset += envelope_size;
3269            _next_ordinal_to_read += 1;
3270            if next_offset >= end_offset {
3271                return Ok(());
3272            }
3273
3274            // Decode unknown envelopes for gaps in ordinals.
3275            while _next_ordinal_to_read < 3 {
3276                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3277                _next_ordinal_to_read += 1;
3278                next_offset += envelope_size;
3279            }
3280
3281            let next_out_of_line = decoder.next_out_of_line();
3282            let handles_before = decoder.remaining_handles();
3283            if let Some((inlined, num_bytes, num_handles)) =
3284                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3285            {
3286                let member_inline_size =
3287                    <fidl::encoding::BoundedString<100> as fidl::encoding::TypeMarker>::inline_size(
3288                        decoder.context,
3289                    );
3290                if inlined != (member_inline_size <= 4) {
3291                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3292                }
3293                let inner_offset;
3294                let mut inner_depth = depth.clone();
3295                if inlined {
3296                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3297                    inner_offset = next_offset;
3298                } else {
3299                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3300                    inner_depth.increment()?;
3301                }
3302                let val_ref = self
3303                    .name
3304                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<100>, D));
3305                fidl::decode!(
3306                    fidl::encoding::BoundedString<100>,
3307                    D,
3308                    val_ref,
3309                    decoder,
3310                    inner_offset,
3311                    inner_depth
3312                )?;
3313                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3314                {
3315                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3316                }
3317                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3318                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3319                }
3320            }
3321
3322            next_offset += envelope_size;
3323
3324            // Decode the remaining unknown envelopes.
3325            while next_offset < end_offset {
3326                _next_ordinal_to_read += 1;
3327                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3328                next_offset += envelope_size;
3329            }
3330
3331            Ok(())
3332        }
3333    }
3334
3335    impl ProviderSpec {
3336        #[inline(always)]
3337        fn max_ordinal_present(&self) -> u64 {
3338            if let Some(_) = self.categories {
3339                return 3;
3340            }
3341            if let Some(_) = self.buffer_size_megabytes_hint {
3342                return 2;
3343            }
3344            if let Some(_) = self.name {
3345                return 1;
3346            }
3347            0
3348        }
3349    }
3350
3351    impl fidl::encoding::ValueTypeMarker for ProviderSpec {
3352        type Borrowed<'a> = &'a Self;
3353        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3354            value
3355        }
3356    }
3357
3358    unsafe impl fidl::encoding::TypeMarker for ProviderSpec {
3359        type Owned = Self;
3360
3361        #[inline(always)]
3362        fn inline_align(_context: fidl::encoding::Context) -> usize {
3363            8
3364        }
3365
3366        #[inline(always)]
3367        fn inline_size(_context: fidl::encoding::Context) -> usize {
3368            16
3369        }
3370    }
3371
3372    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ProviderSpec, D>
3373        for &ProviderSpec
3374    {
3375        unsafe fn encode(
3376            self,
3377            encoder: &mut fidl::encoding::Encoder<'_, D>,
3378            offset: usize,
3379            mut depth: fidl::encoding::Depth,
3380        ) -> fidl::Result<()> {
3381            encoder.debug_check_bounds::<ProviderSpec>(offset);
3382            // Vector header
3383            let max_ordinal: u64 = self.max_ordinal_present();
3384            encoder.write_num(max_ordinal, offset);
3385            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3386            // Calling encoder.out_of_line_offset(0) is not allowed.
3387            if max_ordinal == 0 {
3388                return Ok(());
3389            }
3390            depth.increment()?;
3391            let envelope_size = 8;
3392            let bytes_len = max_ordinal as usize * envelope_size;
3393            #[allow(unused_variables)]
3394            let offset = encoder.out_of_line_offset(bytes_len);
3395            let mut _prev_end_offset: usize = 0;
3396            if 1 > max_ordinal {
3397                return Ok(());
3398            }
3399
3400            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3401            // are envelope_size bytes.
3402            let cur_offset: usize = (1 - 1) * envelope_size;
3403
3404            // Zero reserved fields.
3405            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3406
3407            // Safety:
3408            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3409            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3410            //   envelope_size bytes, there is always sufficient room.
3411            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<100>, D>(
3412                self.name.as_ref().map(
3413                    <fidl::encoding::BoundedString<100> as fidl::encoding::ValueTypeMarker>::borrow,
3414                ),
3415                encoder,
3416                offset + cur_offset,
3417                depth,
3418            )?;
3419
3420            _prev_end_offset = cur_offset + envelope_size;
3421            if 2 > max_ordinal {
3422                return Ok(());
3423            }
3424
3425            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3426            // are envelope_size bytes.
3427            let cur_offset: usize = (2 - 1) * envelope_size;
3428
3429            // Zero reserved fields.
3430            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3431
3432            // Safety:
3433            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3434            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3435            //   envelope_size bytes, there is always sufficient room.
3436            fidl::encoding::encode_in_envelope_optional::<u32, D>(
3437                self.buffer_size_megabytes_hint
3438                    .as_ref()
3439                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3440                encoder,
3441                offset + cur_offset,
3442                depth,
3443            )?;
3444
3445            _prev_end_offset = cur_offset + envelope_size;
3446            if 3 > max_ordinal {
3447                return Ok(());
3448            }
3449
3450            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3451            // are envelope_size bytes.
3452            let cur_offset: usize = (3 - 1) * envelope_size;
3453
3454            // Zero reserved fields.
3455            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3456
3457            // Safety:
3458            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3459            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3460            //   envelope_size bytes, there is always sufficient room.
3461            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 5000>, D>(
3462            self.categories.as_ref().map(<fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 5000> as fidl::encoding::ValueTypeMarker>::borrow),
3463            encoder, offset + cur_offset, depth
3464        )?;
3465
3466            _prev_end_offset = cur_offset + envelope_size;
3467
3468            Ok(())
3469        }
3470    }
3471
3472    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ProviderSpec {
3473        #[inline(always)]
3474        fn new_empty() -> Self {
3475            Self::default()
3476        }
3477
3478        unsafe fn decode(
3479            &mut self,
3480            decoder: &mut fidl::encoding::Decoder<'_, D>,
3481            offset: usize,
3482            mut depth: fidl::encoding::Depth,
3483        ) -> fidl::Result<()> {
3484            decoder.debug_check_bounds::<Self>(offset);
3485            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3486                None => return Err(fidl::Error::NotNullable),
3487                Some(len) => len,
3488            };
3489            // Calling decoder.out_of_line_offset(0) is not allowed.
3490            if len == 0 {
3491                return Ok(());
3492            };
3493            depth.increment()?;
3494            let envelope_size = 8;
3495            let bytes_len = len * envelope_size;
3496            let offset = decoder.out_of_line_offset(bytes_len)?;
3497            // Decode the envelope for each type.
3498            let mut _next_ordinal_to_read = 0;
3499            let mut next_offset = offset;
3500            let end_offset = offset + bytes_len;
3501            _next_ordinal_to_read += 1;
3502            if next_offset >= end_offset {
3503                return Ok(());
3504            }
3505
3506            // Decode unknown envelopes for gaps in ordinals.
3507            while _next_ordinal_to_read < 1 {
3508                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3509                _next_ordinal_to_read += 1;
3510                next_offset += envelope_size;
3511            }
3512
3513            let next_out_of_line = decoder.next_out_of_line();
3514            let handles_before = decoder.remaining_handles();
3515            if let Some((inlined, num_bytes, num_handles)) =
3516                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3517            {
3518                let member_inline_size =
3519                    <fidl::encoding::BoundedString<100> as fidl::encoding::TypeMarker>::inline_size(
3520                        decoder.context,
3521                    );
3522                if inlined != (member_inline_size <= 4) {
3523                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3524                }
3525                let inner_offset;
3526                let mut inner_depth = depth.clone();
3527                if inlined {
3528                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3529                    inner_offset = next_offset;
3530                } else {
3531                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3532                    inner_depth.increment()?;
3533                }
3534                let val_ref = self
3535                    .name
3536                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<100>, D));
3537                fidl::decode!(
3538                    fidl::encoding::BoundedString<100>,
3539                    D,
3540                    val_ref,
3541                    decoder,
3542                    inner_offset,
3543                    inner_depth
3544                )?;
3545                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3546                {
3547                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3548                }
3549                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3550                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3551                }
3552            }
3553
3554            next_offset += envelope_size;
3555            _next_ordinal_to_read += 1;
3556            if next_offset >= end_offset {
3557                return Ok(());
3558            }
3559
3560            // Decode unknown envelopes for gaps in ordinals.
3561            while _next_ordinal_to_read < 2 {
3562                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3563                _next_ordinal_to_read += 1;
3564                next_offset += envelope_size;
3565            }
3566
3567            let next_out_of_line = decoder.next_out_of_line();
3568            let handles_before = decoder.remaining_handles();
3569            if let Some((inlined, num_bytes, num_handles)) =
3570                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3571            {
3572                let member_inline_size =
3573                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3574                if inlined != (member_inline_size <= 4) {
3575                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3576                }
3577                let inner_offset;
3578                let mut inner_depth = depth.clone();
3579                if inlined {
3580                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3581                    inner_offset = next_offset;
3582                } else {
3583                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3584                    inner_depth.increment()?;
3585                }
3586                let val_ref =
3587                    self.buffer_size_megabytes_hint.get_or_insert_with(|| fidl::new_empty!(u32, D));
3588                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
3589                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3590                {
3591                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3592                }
3593                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3594                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3595                }
3596            }
3597
3598            next_offset += envelope_size;
3599            _next_ordinal_to_read += 1;
3600            if next_offset >= end_offset {
3601                return Ok(());
3602            }
3603
3604            // Decode unknown envelopes for gaps in ordinals.
3605            while _next_ordinal_to_read < 3 {
3606                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3607                _next_ordinal_to_read += 1;
3608                next_offset += envelope_size;
3609            }
3610
3611            let next_out_of_line = decoder.next_out_of_line();
3612            let handles_before = decoder.remaining_handles();
3613            if let Some((inlined, num_bytes, num_handles)) =
3614                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3615            {
3616                let member_inline_size = <fidl::encoding::Vector<
3617                    fidl::encoding::BoundedString<100>,
3618                    5000,
3619                > as fidl::encoding::TypeMarker>::inline_size(
3620                    decoder.context
3621                );
3622                if inlined != (member_inline_size <= 4) {
3623                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3624                }
3625                let inner_offset;
3626                let mut inner_depth = depth.clone();
3627                if inlined {
3628                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3629                    inner_offset = next_offset;
3630                } else {
3631                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3632                    inner_depth.increment()?;
3633                }
3634                let val_ref = self.categories.get_or_insert_with(|| {
3635                    fidl::new_empty!(
3636                        fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 5000>,
3637                        D
3638                    )
3639                });
3640                fidl::decode!(
3641                    fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 5000>,
3642                    D,
3643                    val_ref,
3644                    decoder,
3645                    inner_offset,
3646                    inner_depth
3647                )?;
3648                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3649                {
3650                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3651                }
3652                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3653                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3654                }
3655            }
3656
3657            next_offset += envelope_size;
3658
3659            // Decode the remaining unknown envelopes.
3660            while next_offset < end_offset {
3661                _next_ordinal_to_read += 1;
3662                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3663                next_offset += envelope_size;
3664            }
3665
3666            Ok(())
3667        }
3668    }
3669
3670    impl ProviderStats {
3671        #[inline(always)]
3672        fn max_ordinal_present(&self) -> u64 {
3673            if let Some(_) = self.non_durable_bytes_written {
3674                return 7;
3675            }
3676            if let Some(_) = self.percentage_durable_buffer_used {
3677                return 6;
3678            }
3679            if let Some(_) = self.records_dropped {
3680                return 5;
3681            }
3682            if let Some(_) = self.buffer_wrapped_count {
3683                return 4;
3684            }
3685            if let Some(_) = self.buffering_mode {
3686                return 3;
3687            }
3688            if let Some(_) = self.pid {
3689                return 2;
3690            }
3691            if let Some(_) = self.name {
3692                return 1;
3693            }
3694            0
3695        }
3696    }
3697
3698    impl fidl::encoding::ValueTypeMarker for ProviderStats {
3699        type Borrowed<'a> = &'a Self;
3700        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3701            value
3702        }
3703    }
3704
3705    unsafe impl fidl::encoding::TypeMarker for ProviderStats {
3706        type Owned = Self;
3707
3708        #[inline(always)]
3709        fn inline_align(_context: fidl::encoding::Context) -> usize {
3710            8
3711        }
3712
3713        #[inline(always)]
3714        fn inline_size(_context: fidl::encoding::Context) -> usize {
3715            16
3716        }
3717    }
3718
3719    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ProviderStats, D>
3720        for &ProviderStats
3721    {
3722        unsafe fn encode(
3723            self,
3724            encoder: &mut fidl::encoding::Encoder<'_, D>,
3725            offset: usize,
3726            mut depth: fidl::encoding::Depth,
3727        ) -> fidl::Result<()> {
3728            encoder.debug_check_bounds::<ProviderStats>(offset);
3729            // Vector header
3730            let max_ordinal: u64 = self.max_ordinal_present();
3731            encoder.write_num(max_ordinal, offset);
3732            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3733            // Calling encoder.out_of_line_offset(0) is not allowed.
3734            if max_ordinal == 0 {
3735                return Ok(());
3736            }
3737            depth.increment()?;
3738            let envelope_size = 8;
3739            let bytes_len = max_ordinal as usize * envelope_size;
3740            #[allow(unused_variables)]
3741            let offset = encoder.out_of_line_offset(bytes_len);
3742            let mut _prev_end_offset: usize = 0;
3743            if 1 > max_ordinal {
3744                return Ok(());
3745            }
3746
3747            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3748            // are envelope_size bytes.
3749            let cur_offset: usize = (1 - 1) * envelope_size;
3750
3751            // Zero reserved fields.
3752            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3753
3754            // Safety:
3755            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3756            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3757            //   envelope_size bytes, there is always sufficient room.
3758            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<100>, D>(
3759                self.name.as_ref().map(
3760                    <fidl::encoding::BoundedString<100> as fidl::encoding::ValueTypeMarker>::borrow,
3761                ),
3762                encoder,
3763                offset + cur_offset,
3764                depth,
3765            )?;
3766
3767            _prev_end_offset = cur_offset + envelope_size;
3768            if 2 > max_ordinal {
3769                return Ok(());
3770            }
3771
3772            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3773            // are envelope_size bytes.
3774            let cur_offset: usize = (2 - 1) * envelope_size;
3775
3776            // Zero reserved fields.
3777            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3778
3779            // Safety:
3780            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3781            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3782            //   envelope_size bytes, there is always sufficient room.
3783            fidl::encoding::encode_in_envelope_optional::<u64, D>(
3784                self.pid.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3785                encoder,
3786                offset + cur_offset,
3787                depth,
3788            )?;
3789
3790            _prev_end_offset = cur_offset + envelope_size;
3791            if 3 > max_ordinal {
3792                return Ok(());
3793            }
3794
3795            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3796            // are envelope_size bytes.
3797            let cur_offset: usize = (3 - 1) * envelope_size;
3798
3799            // Zero reserved fields.
3800            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3801
3802            // Safety:
3803            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3804            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3805            //   envelope_size bytes, there is always sufficient room.
3806            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_tracing::BufferingMode, D>(
3807            self.buffering_mode.as_ref().map(<fidl_fuchsia_tracing::BufferingMode as fidl::encoding::ValueTypeMarker>::borrow),
3808            encoder, offset + cur_offset, depth
3809        )?;
3810
3811            _prev_end_offset = cur_offset + envelope_size;
3812            if 4 > max_ordinal {
3813                return Ok(());
3814            }
3815
3816            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3817            // are envelope_size bytes.
3818            let cur_offset: usize = (4 - 1) * envelope_size;
3819
3820            // Zero reserved fields.
3821            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3822
3823            // Safety:
3824            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3825            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3826            //   envelope_size bytes, there is always sufficient room.
3827            fidl::encoding::encode_in_envelope_optional::<u32, D>(
3828                self.buffer_wrapped_count
3829                    .as_ref()
3830                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3831                encoder,
3832                offset + cur_offset,
3833                depth,
3834            )?;
3835
3836            _prev_end_offset = cur_offset + envelope_size;
3837            if 5 > max_ordinal {
3838                return Ok(());
3839            }
3840
3841            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3842            // are envelope_size bytes.
3843            let cur_offset: usize = (5 - 1) * envelope_size;
3844
3845            // Zero reserved fields.
3846            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3847
3848            // Safety:
3849            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3850            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3851            //   envelope_size bytes, there is always sufficient room.
3852            fidl::encoding::encode_in_envelope_optional::<u64, D>(
3853                self.records_dropped.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3854                encoder,
3855                offset + cur_offset,
3856                depth,
3857            )?;
3858
3859            _prev_end_offset = cur_offset + envelope_size;
3860            if 6 > max_ordinal {
3861                return Ok(());
3862            }
3863
3864            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3865            // are envelope_size bytes.
3866            let cur_offset: usize = (6 - 1) * envelope_size;
3867
3868            // Zero reserved fields.
3869            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3870
3871            // Safety:
3872            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3873            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3874            //   envelope_size bytes, there is always sufficient room.
3875            fidl::encoding::encode_in_envelope_optional::<f32, D>(
3876                self.percentage_durable_buffer_used
3877                    .as_ref()
3878                    .map(<f32 as fidl::encoding::ValueTypeMarker>::borrow),
3879                encoder,
3880                offset + cur_offset,
3881                depth,
3882            )?;
3883
3884            _prev_end_offset = cur_offset + envelope_size;
3885            if 7 > max_ordinal {
3886                return Ok(());
3887            }
3888
3889            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3890            // are envelope_size bytes.
3891            let cur_offset: usize = (7 - 1) * envelope_size;
3892
3893            // Zero reserved fields.
3894            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3895
3896            // Safety:
3897            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3898            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3899            //   envelope_size bytes, there is always sufficient room.
3900            fidl::encoding::encode_in_envelope_optional::<u64, D>(
3901                self.non_durable_bytes_written
3902                    .as_ref()
3903                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3904                encoder,
3905                offset + cur_offset,
3906                depth,
3907            )?;
3908
3909            _prev_end_offset = cur_offset + envelope_size;
3910
3911            Ok(())
3912        }
3913    }
3914
3915    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ProviderStats {
3916        #[inline(always)]
3917        fn new_empty() -> Self {
3918            Self::default()
3919        }
3920
3921        unsafe fn decode(
3922            &mut self,
3923            decoder: &mut fidl::encoding::Decoder<'_, D>,
3924            offset: usize,
3925            mut depth: fidl::encoding::Depth,
3926        ) -> fidl::Result<()> {
3927            decoder.debug_check_bounds::<Self>(offset);
3928            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3929                None => return Err(fidl::Error::NotNullable),
3930                Some(len) => len,
3931            };
3932            // Calling decoder.out_of_line_offset(0) is not allowed.
3933            if len == 0 {
3934                return Ok(());
3935            };
3936            depth.increment()?;
3937            let envelope_size = 8;
3938            let bytes_len = len * envelope_size;
3939            let offset = decoder.out_of_line_offset(bytes_len)?;
3940            // Decode the envelope for each type.
3941            let mut _next_ordinal_to_read = 0;
3942            let mut next_offset = offset;
3943            let end_offset = offset + bytes_len;
3944            _next_ordinal_to_read += 1;
3945            if next_offset >= end_offset {
3946                return Ok(());
3947            }
3948
3949            // Decode unknown envelopes for gaps in ordinals.
3950            while _next_ordinal_to_read < 1 {
3951                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3952                _next_ordinal_to_read += 1;
3953                next_offset += envelope_size;
3954            }
3955
3956            let next_out_of_line = decoder.next_out_of_line();
3957            let handles_before = decoder.remaining_handles();
3958            if let Some((inlined, num_bytes, num_handles)) =
3959                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3960            {
3961                let member_inline_size =
3962                    <fidl::encoding::BoundedString<100> as fidl::encoding::TypeMarker>::inline_size(
3963                        decoder.context,
3964                    );
3965                if inlined != (member_inline_size <= 4) {
3966                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3967                }
3968                let inner_offset;
3969                let mut inner_depth = depth.clone();
3970                if inlined {
3971                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3972                    inner_offset = next_offset;
3973                } else {
3974                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3975                    inner_depth.increment()?;
3976                }
3977                let val_ref = self
3978                    .name
3979                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<100>, D));
3980                fidl::decode!(
3981                    fidl::encoding::BoundedString<100>,
3982                    D,
3983                    val_ref,
3984                    decoder,
3985                    inner_offset,
3986                    inner_depth
3987                )?;
3988                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3989                {
3990                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3991                }
3992                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3993                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3994                }
3995            }
3996
3997            next_offset += envelope_size;
3998            _next_ordinal_to_read += 1;
3999            if next_offset >= end_offset {
4000                return Ok(());
4001            }
4002
4003            // Decode unknown envelopes for gaps in ordinals.
4004            while _next_ordinal_to_read < 2 {
4005                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4006                _next_ordinal_to_read += 1;
4007                next_offset += envelope_size;
4008            }
4009
4010            let next_out_of_line = decoder.next_out_of_line();
4011            let handles_before = decoder.remaining_handles();
4012            if let Some((inlined, num_bytes, num_handles)) =
4013                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4014            {
4015                let member_inline_size =
4016                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4017                if inlined != (member_inline_size <= 4) {
4018                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4019                }
4020                let inner_offset;
4021                let mut inner_depth = depth.clone();
4022                if inlined {
4023                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4024                    inner_offset = next_offset;
4025                } else {
4026                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4027                    inner_depth.increment()?;
4028                }
4029                let val_ref = self.pid.get_or_insert_with(|| fidl::new_empty!(u64, D));
4030                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
4031                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4032                {
4033                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4034                }
4035                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4036                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4037                }
4038            }
4039
4040            next_offset += envelope_size;
4041            _next_ordinal_to_read += 1;
4042            if next_offset >= end_offset {
4043                return Ok(());
4044            }
4045
4046            // Decode unknown envelopes for gaps in ordinals.
4047            while _next_ordinal_to_read < 3 {
4048                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4049                _next_ordinal_to_read += 1;
4050                next_offset += envelope_size;
4051            }
4052
4053            let next_out_of_line = decoder.next_out_of_line();
4054            let handles_before = decoder.remaining_handles();
4055            if let Some((inlined, num_bytes, num_handles)) =
4056                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4057            {
4058                let member_inline_size = <fidl_fuchsia_tracing::BufferingMode as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4059                if inlined != (member_inline_size <= 4) {
4060                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4061                }
4062                let inner_offset;
4063                let mut inner_depth = depth.clone();
4064                if inlined {
4065                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4066                    inner_offset = next_offset;
4067                } else {
4068                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4069                    inner_depth.increment()?;
4070                }
4071                let val_ref = self.buffering_mode.get_or_insert_with(|| {
4072                    fidl::new_empty!(fidl_fuchsia_tracing::BufferingMode, D)
4073                });
4074                fidl::decode!(
4075                    fidl_fuchsia_tracing::BufferingMode,
4076                    D,
4077                    val_ref,
4078                    decoder,
4079                    inner_offset,
4080                    inner_depth
4081                )?;
4082                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4083                {
4084                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4085                }
4086                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4087                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4088                }
4089            }
4090
4091            next_offset += envelope_size;
4092            _next_ordinal_to_read += 1;
4093            if next_offset >= end_offset {
4094                return Ok(());
4095            }
4096
4097            // Decode unknown envelopes for gaps in ordinals.
4098            while _next_ordinal_to_read < 4 {
4099                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4100                _next_ordinal_to_read += 1;
4101                next_offset += envelope_size;
4102            }
4103
4104            let next_out_of_line = decoder.next_out_of_line();
4105            let handles_before = decoder.remaining_handles();
4106            if let Some((inlined, num_bytes, num_handles)) =
4107                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4108            {
4109                let member_inline_size =
4110                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4111                if inlined != (member_inline_size <= 4) {
4112                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4113                }
4114                let inner_offset;
4115                let mut inner_depth = depth.clone();
4116                if inlined {
4117                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4118                    inner_offset = next_offset;
4119                } else {
4120                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4121                    inner_depth.increment()?;
4122                }
4123                let val_ref =
4124                    self.buffer_wrapped_count.get_or_insert_with(|| fidl::new_empty!(u32, D));
4125                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
4126                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4127                {
4128                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4129                }
4130                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4131                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4132                }
4133            }
4134
4135            next_offset += envelope_size;
4136            _next_ordinal_to_read += 1;
4137            if next_offset >= end_offset {
4138                return Ok(());
4139            }
4140
4141            // Decode unknown envelopes for gaps in ordinals.
4142            while _next_ordinal_to_read < 5 {
4143                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4144                _next_ordinal_to_read += 1;
4145                next_offset += envelope_size;
4146            }
4147
4148            let next_out_of_line = decoder.next_out_of_line();
4149            let handles_before = decoder.remaining_handles();
4150            if let Some((inlined, num_bytes, num_handles)) =
4151                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4152            {
4153                let member_inline_size =
4154                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4155                if inlined != (member_inline_size <= 4) {
4156                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4157                }
4158                let inner_offset;
4159                let mut inner_depth = depth.clone();
4160                if inlined {
4161                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4162                    inner_offset = next_offset;
4163                } else {
4164                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4165                    inner_depth.increment()?;
4166                }
4167                let val_ref = self.records_dropped.get_or_insert_with(|| fidl::new_empty!(u64, D));
4168                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
4169                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4170                {
4171                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4172                }
4173                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4174                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4175                }
4176            }
4177
4178            next_offset += envelope_size;
4179            _next_ordinal_to_read += 1;
4180            if next_offset >= end_offset {
4181                return Ok(());
4182            }
4183
4184            // Decode unknown envelopes for gaps in ordinals.
4185            while _next_ordinal_to_read < 6 {
4186                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4187                _next_ordinal_to_read += 1;
4188                next_offset += envelope_size;
4189            }
4190
4191            let next_out_of_line = decoder.next_out_of_line();
4192            let handles_before = decoder.remaining_handles();
4193            if let Some((inlined, num_bytes, num_handles)) =
4194                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4195            {
4196                let member_inline_size =
4197                    <f32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4198                if inlined != (member_inline_size <= 4) {
4199                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4200                }
4201                let inner_offset;
4202                let mut inner_depth = depth.clone();
4203                if inlined {
4204                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4205                    inner_offset = next_offset;
4206                } else {
4207                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4208                    inner_depth.increment()?;
4209                }
4210                let val_ref = self
4211                    .percentage_durable_buffer_used
4212                    .get_or_insert_with(|| fidl::new_empty!(f32, D));
4213                fidl::decode!(f32, D, val_ref, decoder, inner_offset, inner_depth)?;
4214                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4215                {
4216                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4217                }
4218                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4219                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4220                }
4221            }
4222
4223            next_offset += envelope_size;
4224            _next_ordinal_to_read += 1;
4225            if next_offset >= end_offset {
4226                return Ok(());
4227            }
4228
4229            // Decode unknown envelopes for gaps in ordinals.
4230            while _next_ordinal_to_read < 7 {
4231                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4232                _next_ordinal_to_read += 1;
4233                next_offset += envelope_size;
4234            }
4235
4236            let next_out_of_line = decoder.next_out_of_line();
4237            let handles_before = decoder.remaining_handles();
4238            if let Some((inlined, num_bytes, num_handles)) =
4239                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4240            {
4241                let member_inline_size =
4242                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4243                if inlined != (member_inline_size <= 4) {
4244                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4245                }
4246                let inner_offset;
4247                let mut inner_depth = depth.clone();
4248                if inlined {
4249                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4250                    inner_offset = next_offset;
4251                } else {
4252                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4253                    inner_depth.increment()?;
4254                }
4255                let val_ref =
4256                    self.non_durable_bytes_written.get_or_insert_with(|| fidl::new_empty!(u64, D));
4257                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
4258                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4259                {
4260                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4261                }
4262                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4263                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4264                }
4265            }
4266
4267            next_offset += envelope_size;
4268
4269            // Decode the remaining unknown envelopes.
4270            while next_offset < end_offset {
4271                _next_ordinal_to_read += 1;
4272                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4273                next_offset += envelope_size;
4274            }
4275
4276            Ok(())
4277        }
4278    }
4279
4280    impl StartOptions {
4281        #[inline(always)]
4282        fn max_ordinal_present(&self) -> u64 {
4283            if let Some(_) = self.additional_categories {
4284                return 2;
4285            }
4286            if let Some(_) = self.buffer_disposition {
4287                return 1;
4288            }
4289            0
4290        }
4291    }
4292
4293    impl fidl::encoding::ValueTypeMarker for StartOptions {
4294        type Borrowed<'a> = &'a Self;
4295        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4296            value
4297        }
4298    }
4299
4300    unsafe impl fidl::encoding::TypeMarker for StartOptions {
4301        type Owned = Self;
4302
4303        #[inline(always)]
4304        fn inline_align(_context: fidl::encoding::Context) -> usize {
4305            8
4306        }
4307
4308        #[inline(always)]
4309        fn inline_size(_context: fidl::encoding::Context) -> usize {
4310            16
4311        }
4312    }
4313
4314    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StartOptions, D>
4315        for &StartOptions
4316    {
4317        unsafe fn encode(
4318            self,
4319            encoder: &mut fidl::encoding::Encoder<'_, D>,
4320            offset: usize,
4321            mut depth: fidl::encoding::Depth,
4322        ) -> fidl::Result<()> {
4323            encoder.debug_check_bounds::<StartOptions>(offset);
4324            // Vector header
4325            let max_ordinal: u64 = self.max_ordinal_present();
4326            encoder.write_num(max_ordinal, offset);
4327            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4328            // Calling encoder.out_of_line_offset(0) is not allowed.
4329            if max_ordinal == 0 {
4330                return Ok(());
4331            }
4332            depth.increment()?;
4333            let envelope_size = 8;
4334            let bytes_len = max_ordinal as usize * envelope_size;
4335            #[allow(unused_variables)]
4336            let offset = encoder.out_of_line_offset(bytes_len);
4337            let mut _prev_end_offset: usize = 0;
4338            if 1 > max_ordinal {
4339                return Ok(());
4340            }
4341
4342            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4343            // are envelope_size bytes.
4344            let cur_offset: usize = (1 - 1) * envelope_size;
4345
4346            // Zero reserved fields.
4347            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4348
4349            // Safety:
4350            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4351            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4352            //   envelope_size bytes, there is always sufficient room.
4353            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_tracing::BufferDisposition, D>(
4354            self.buffer_disposition.as_ref().map(<fidl_fuchsia_tracing::BufferDisposition as fidl::encoding::ValueTypeMarker>::borrow),
4355            encoder, offset + cur_offset, depth
4356        )?;
4357
4358            _prev_end_offset = cur_offset + envelope_size;
4359            if 2 > max_ordinal {
4360                return Ok(());
4361            }
4362
4363            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4364            // are envelope_size bytes.
4365            let cur_offset: usize = (2 - 1) * envelope_size;
4366
4367            // Zero reserved fields.
4368            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4369
4370            // Safety:
4371            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4372            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4373            //   envelope_size bytes, there is always sufficient room.
4374            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 5000>, D>(
4375            self.additional_categories.as_ref().map(<fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 5000> as fidl::encoding::ValueTypeMarker>::borrow),
4376            encoder, offset + cur_offset, depth
4377        )?;
4378
4379            _prev_end_offset = cur_offset + envelope_size;
4380
4381            Ok(())
4382        }
4383    }
4384
4385    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StartOptions {
4386        #[inline(always)]
4387        fn new_empty() -> Self {
4388            Self::default()
4389        }
4390
4391        unsafe fn decode(
4392            &mut self,
4393            decoder: &mut fidl::encoding::Decoder<'_, D>,
4394            offset: usize,
4395            mut depth: fidl::encoding::Depth,
4396        ) -> fidl::Result<()> {
4397            decoder.debug_check_bounds::<Self>(offset);
4398            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4399                None => return Err(fidl::Error::NotNullable),
4400                Some(len) => len,
4401            };
4402            // Calling decoder.out_of_line_offset(0) is not allowed.
4403            if len == 0 {
4404                return Ok(());
4405            };
4406            depth.increment()?;
4407            let envelope_size = 8;
4408            let bytes_len = len * envelope_size;
4409            let offset = decoder.out_of_line_offset(bytes_len)?;
4410            // Decode the envelope for each type.
4411            let mut _next_ordinal_to_read = 0;
4412            let mut next_offset = offset;
4413            let end_offset = offset + bytes_len;
4414            _next_ordinal_to_read += 1;
4415            if next_offset >= end_offset {
4416                return Ok(());
4417            }
4418
4419            // Decode unknown envelopes for gaps in ordinals.
4420            while _next_ordinal_to_read < 1 {
4421                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4422                _next_ordinal_to_read += 1;
4423                next_offset += envelope_size;
4424            }
4425
4426            let next_out_of_line = decoder.next_out_of_line();
4427            let handles_before = decoder.remaining_handles();
4428            if let Some((inlined, num_bytes, num_handles)) =
4429                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4430            {
4431                let member_inline_size = <fidl_fuchsia_tracing::BufferDisposition as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4432                if inlined != (member_inline_size <= 4) {
4433                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4434                }
4435                let inner_offset;
4436                let mut inner_depth = depth.clone();
4437                if inlined {
4438                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4439                    inner_offset = next_offset;
4440                } else {
4441                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4442                    inner_depth.increment()?;
4443                }
4444                let val_ref = self.buffer_disposition.get_or_insert_with(|| {
4445                    fidl::new_empty!(fidl_fuchsia_tracing::BufferDisposition, D)
4446                });
4447                fidl::decode!(
4448                    fidl_fuchsia_tracing::BufferDisposition,
4449                    D,
4450                    val_ref,
4451                    decoder,
4452                    inner_offset,
4453                    inner_depth
4454                )?;
4455                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4456                {
4457                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4458                }
4459                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4460                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4461                }
4462            }
4463
4464            next_offset += envelope_size;
4465            _next_ordinal_to_read += 1;
4466            if next_offset >= end_offset {
4467                return Ok(());
4468            }
4469
4470            // Decode unknown envelopes for gaps in ordinals.
4471            while _next_ordinal_to_read < 2 {
4472                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4473                _next_ordinal_to_read += 1;
4474                next_offset += envelope_size;
4475            }
4476
4477            let next_out_of_line = decoder.next_out_of_line();
4478            let handles_before = decoder.remaining_handles();
4479            if let Some((inlined, num_bytes, num_handles)) =
4480                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4481            {
4482                let member_inline_size = <fidl::encoding::Vector<
4483                    fidl::encoding::BoundedString<100>,
4484                    5000,
4485                > as fidl::encoding::TypeMarker>::inline_size(
4486                    decoder.context
4487                );
4488                if inlined != (member_inline_size <= 4) {
4489                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4490                }
4491                let inner_offset;
4492                let mut inner_depth = depth.clone();
4493                if inlined {
4494                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4495                    inner_offset = next_offset;
4496                } else {
4497                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4498                    inner_depth.increment()?;
4499                }
4500                let val_ref = self.additional_categories.get_or_insert_with(|| {
4501                    fidl::new_empty!(
4502                        fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 5000>,
4503                        D
4504                    )
4505                });
4506                fidl::decode!(
4507                    fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 5000>,
4508                    D,
4509                    val_ref,
4510                    decoder,
4511                    inner_offset,
4512                    inner_depth
4513                )?;
4514                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4515                {
4516                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4517                }
4518                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4519                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4520                }
4521            }
4522
4523            next_offset += envelope_size;
4524
4525            // Decode the remaining unknown envelopes.
4526            while next_offset < end_offset {
4527                _next_ordinal_to_read += 1;
4528                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4529                next_offset += envelope_size;
4530            }
4531
4532            Ok(())
4533        }
4534    }
4535
4536    impl StopOptions {
4537        #[inline(always)]
4538        fn max_ordinal_present(&self) -> u64 {
4539            if let Some(_) = self.write_results {
4540                return 1;
4541            }
4542            0
4543        }
4544    }
4545
4546    impl fidl::encoding::ValueTypeMarker for StopOptions {
4547        type Borrowed<'a> = &'a Self;
4548        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4549            value
4550        }
4551    }
4552
4553    unsafe impl fidl::encoding::TypeMarker for StopOptions {
4554        type Owned = Self;
4555
4556        #[inline(always)]
4557        fn inline_align(_context: fidl::encoding::Context) -> usize {
4558            8
4559        }
4560
4561        #[inline(always)]
4562        fn inline_size(_context: fidl::encoding::Context) -> usize {
4563            16
4564        }
4565    }
4566
4567    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StopOptions, D>
4568        for &StopOptions
4569    {
4570        unsafe fn encode(
4571            self,
4572            encoder: &mut fidl::encoding::Encoder<'_, D>,
4573            offset: usize,
4574            mut depth: fidl::encoding::Depth,
4575        ) -> fidl::Result<()> {
4576            encoder.debug_check_bounds::<StopOptions>(offset);
4577            // Vector header
4578            let max_ordinal: u64 = self.max_ordinal_present();
4579            encoder.write_num(max_ordinal, offset);
4580            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4581            // Calling encoder.out_of_line_offset(0) is not allowed.
4582            if max_ordinal == 0 {
4583                return Ok(());
4584            }
4585            depth.increment()?;
4586            let envelope_size = 8;
4587            let bytes_len = max_ordinal as usize * envelope_size;
4588            #[allow(unused_variables)]
4589            let offset = encoder.out_of_line_offset(bytes_len);
4590            let mut _prev_end_offset: usize = 0;
4591            if 1 > max_ordinal {
4592                return Ok(());
4593            }
4594
4595            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4596            // are envelope_size bytes.
4597            let cur_offset: usize = (1 - 1) * envelope_size;
4598
4599            // Zero reserved fields.
4600            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4601
4602            // Safety:
4603            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4604            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4605            //   envelope_size bytes, there is always sufficient room.
4606            fidl::encoding::encode_in_envelope_optional::<bool, D>(
4607                self.write_results.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
4608                encoder,
4609                offset + cur_offset,
4610                depth,
4611            )?;
4612
4613            _prev_end_offset = cur_offset + envelope_size;
4614
4615            Ok(())
4616        }
4617    }
4618
4619    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StopOptions {
4620        #[inline(always)]
4621        fn new_empty() -> Self {
4622            Self::default()
4623        }
4624
4625        unsafe fn decode(
4626            &mut self,
4627            decoder: &mut fidl::encoding::Decoder<'_, D>,
4628            offset: usize,
4629            mut depth: fidl::encoding::Depth,
4630        ) -> fidl::Result<()> {
4631            decoder.debug_check_bounds::<Self>(offset);
4632            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4633                None => return Err(fidl::Error::NotNullable),
4634                Some(len) => len,
4635            };
4636            // Calling decoder.out_of_line_offset(0) is not allowed.
4637            if len == 0 {
4638                return Ok(());
4639            };
4640            depth.increment()?;
4641            let envelope_size = 8;
4642            let bytes_len = len * envelope_size;
4643            let offset = decoder.out_of_line_offset(bytes_len)?;
4644            // Decode the envelope for each type.
4645            let mut _next_ordinal_to_read = 0;
4646            let mut next_offset = offset;
4647            let end_offset = offset + bytes_len;
4648            _next_ordinal_to_read += 1;
4649            if next_offset >= end_offset {
4650                return Ok(());
4651            }
4652
4653            // Decode unknown envelopes for gaps in ordinals.
4654            while _next_ordinal_to_read < 1 {
4655                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4656                _next_ordinal_to_read += 1;
4657                next_offset += envelope_size;
4658            }
4659
4660            let next_out_of_line = decoder.next_out_of_line();
4661            let handles_before = decoder.remaining_handles();
4662            if let Some((inlined, num_bytes, num_handles)) =
4663                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4664            {
4665                let member_inline_size =
4666                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4667                if inlined != (member_inline_size <= 4) {
4668                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4669                }
4670                let inner_offset;
4671                let mut inner_depth = depth.clone();
4672                if inlined {
4673                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4674                    inner_offset = next_offset;
4675                } else {
4676                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4677                    inner_depth.increment()?;
4678                }
4679                let val_ref = self.write_results.get_or_insert_with(|| fidl::new_empty!(bool, D));
4680                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
4681                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4682                {
4683                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4684                }
4685                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4686                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4687                }
4688            }
4689
4690            next_offset += envelope_size;
4691
4692            // Decode the remaining unknown envelopes.
4693            while next_offset < end_offset {
4694                _next_ordinal_to_read += 1;
4695                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4696                next_offset += envelope_size;
4697            }
4698
4699            Ok(())
4700        }
4701    }
4702
4703    impl StopResult {
4704        #[inline(always)]
4705        fn max_ordinal_present(&self) -> u64 {
4706            if let Some(_) = self.provider_stats {
4707                return 1;
4708            }
4709            0
4710        }
4711    }
4712
4713    impl fidl::encoding::ValueTypeMarker for StopResult {
4714        type Borrowed<'a> = &'a Self;
4715        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4716            value
4717        }
4718    }
4719
4720    unsafe impl fidl::encoding::TypeMarker for StopResult {
4721        type Owned = Self;
4722
4723        #[inline(always)]
4724        fn inline_align(_context: fidl::encoding::Context) -> usize {
4725            8
4726        }
4727
4728        #[inline(always)]
4729        fn inline_size(_context: fidl::encoding::Context) -> usize {
4730            16
4731        }
4732    }
4733
4734    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StopResult, D>
4735        for &StopResult
4736    {
4737        unsafe fn encode(
4738            self,
4739            encoder: &mut fidl::encoding::Encoder<'_, D>,
4740            offset: usize,
4741            mut depth: fidl::encoding::Depth,
4742        ) -> fidl::Result<()> {
4743            encoder.debug_check_bounds::<StopResult>(offset);
4744            // Vector header
4745            let max_ordinal: u64 = self.max_ordinal_present();
4746            encoder.write_num(max_ordinal, offset);
4747            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4748            // Calling encoder.out_of_line_offset(0) is not allowed.
4749            if max_ordinal == 0 {
4750                return Ok(());
4751            }
4752            depth.increment()?;
4753            let envelope_size = 8;
4754            let bytes_len = max_ordinal as usize * envelope_size;
4755            #[allow(unused_variables)]
4756            let offset = encoder.out_of_line_offset(bytes_len);
4757            let mut _prev_end_offset: usize = 0;
4758            if 1 > max_ordinal {
4759                return Ok(());
4760            }
4761
4762            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4763            // are envelope_size bytes.
4764            let cur_offset: usize = (1 - 1) * envelope_size;
4765
4766            // Zero reserved fields.
4767            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4768
4769            // Safety:
4770            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4771            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4772            //   envelope_size bytes, there is always sufficient room.
4773            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ProviderStats, 100>, D>(
4774            self.provider_stats.as_ref().map(<fidl::encoding::Vector<ProviderStats, 100> as fidl::encoding::ValueTypeMarker>::borrow),
4775            encoder, offset + cur_offset, depth
4776        )?;
4777
4778            _prev_end_offset = cur_offset + envelope_size;
4779
4780            Ok(())
4781        }
4782    }
4783
4784    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StopResult {
4785        #[inline(always)]
4786        fn new_empty() -> Self {
4787            Self::default()
4788        }
4789
4790        unsafe fn decode(
4791            &mut self,
4792            decoder: &mut fidl::encoding::Decoder<'_, D>,
4793            offset: usize,
4794            mut depth: fidl::encoding::Depth,
4795        ) -> fidl::Result<()> {
4796            decoder.debug_check_bounds::<Self>(offset);
4797            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4798                None => return Err(fidl::Error::NotNullable),
4799                Some(len) => len,
4800            };
4801            // Calling decoder.out_of_line_offset(0) is not allowed.
4802            if len == 0 {
4803                return Ok(());
4804            };
4805            depth.increment()?;
4806            let envelope_size = 8;
4807            let bytes_len = len * envelope_size;
4808            let offset = decoder.out_of_line_offset(bytes_len)?;
4809            // Decode the envelope for each type.
4810            let mut _next_ordinal_to_read = 0;
4811            let mut next_offset = offset;
4812            let end_offset = offset + bytes_len;
4813            _next_ordinal_to_read += 1;
4814            if next_offset >= end_offset {
4815                return Ok(());
4816            }
4817
4818            // Decode unknown envelopes for gaps in ordinals.
4819            while _next_ordinal_to_read < 1 {
4820                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4821                _next_ordinal_to_read += 1;
4822                next_offset += envelope_size;
4823            }
4824
4825            let next_out_of_line = decoder.next_out_of_line();
4826            let handles_before = decoder.remaining_handles();
4827            if let Some((inlined, num_bytes, num_handles)) =
4828                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4829            {
4830                let member_inline_size = <fidl::encoding::Vector<ProviderStats, 100> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4831                if inlined != (member_inline_size <= 4) {
4832                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4833                }
4834                let inner_offset;
4835                let mut inner_depth = depth.clone();
4836                if inlined {
4837                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4838                    inner_offset = next_offset;
4839                } else {
4840                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4841                    inner_depth.increment()?;
4842                }
4843                let val_ref = self.provider_stats.get_or_insert_with(
4844                    || fidl::new_empty!(fidl::encoding::Vector<ProviderStats, 100>, D),
4845                );
4846                fidl::decode!(fidl::encoding::Vector<ProviderStats, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
4847                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4848                {
4849                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4850                }
4851                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4852                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4853                }
4854            }
4855
4856            next_offset += envelope_size;
4857
4858            // Decode the remaining unknown envelopes.
4859            while next_offset < end_offset {
4860                _next_ordinal_to_read += 1;
4861                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4862                next_offset += envelope_size;
4863            }
4864
4865            Ok(())
4866        }
4867    }
4868
4869    impl TraceConfig {
4870        #[inline(always)]
4871        fn max_ordinal_present(&self) -> u64 {
4872            if let Some(_) = self.version {
4873                return 6;
4874            }
4875            if let Some(_) = self.provider_specs {
4876                return 5;
4877            }
4878            if let Some(_) = self.buffering_mode {
4879                return 4;
4880            }
4881            if let Some(_) = self.start_timeout_milliseconds {
4882                return 3;
4883            }
4884            if let Some(_) = self.buffer_size_megabytes_hint {
4885                return 2;
4886            }
4887            if let Some(_) = self.categories {
4888                return 1;
4889            }
4890            0
4891        }
4892    }
4893
4894    impl fidl::encoding::ValueTypeMarker for TraceConfig {
4895        type Borrowed<'a> = &'a Self;
4896        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4897            value
4898        }
4899    }
4900
4901    unsafe impl fidl::encoding::TypeMarker for TraceConfig {
4902        type Owned = Self;
4903
4904        #[inline(always)]
4905        fn inline_align(_context: fidl::encoding::Context) -> usize {
4906            8
4907        }
4908
4909        #[inline(always)]
4910        fn inline_size(_context: fidl::encoding::Context) -> usize {
4911            16
4912        }
4913    }
4914
4915    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TraceConfig, D>
4916        for &TraceConfig
4917    {
4918        unsafe fn encode(
4919            self,
4920            encoder: &mut fidl::encoding::Encoder<'_, D>,
4921            offset: usize,
4922            mut depth: fidl::encoding::Depth,
4923        ) -> fidl::Result<()> {
4924            encoder.debug_check_bounds::<TraceConfig>(offset);
4925            // Vector header
4926            let max_ordinal: u64 = self.max_ordinal_present();
4927            encoder.write_num(max_ordinal, offset);
4928            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4929            // Calling encoder.out_of_line_offset(0) is not allowed.
4930            if max_ordinal == 0 {
4931                return Ok(());
4932            }
4933            depth.increment()?;
4934            let envelope_size = 8;
4935            let bytes_len = max_ordinal as usize * envelope_size;
4936            #[allow(unused_variables)]
4937            let offset = encoder.out_of_line_offset(bytes_len);
4938            let mut _prev_end_offset: usize = 0;
4939            if 1 > max_ordinal {
4940                return Ok(());
4941            }
4942
4943            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4944            // are envelope_size bytes.
4945            let cur_offset: usize = (1 - 1) * envelope_size;
4946
4947            // Zero reserved fields.
4948            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4949
4950            // Safety:
4951            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4952            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4953            //   envelope_size bytes, there is always sufficient room.
4954            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 5000>, D>(
4955            self.categories.as_ref().map(<fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 5000> as fidl::encoding::ValueTypeMarker>::borrow),
4956            encoder, offset + cur_offset, depth
4957        )?;
4958
4959            _prev_end_offset = cur_offset + envelope_size;
4960            if 2 > max_ordinal {
4961                return Ok(());
4962            }
4963
4964            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4965            // are envelope_size bytes.
4966            let cur_offset: usize = (2 - 1) * envelope_size;
4967
4968            // Zero reserved fields.
4969            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4970
4971            // Safety:
4972            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4973            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4974            //   envelope_size bytes, there is always sufficient room.
4975            fidl::encoding::encode_in_envelope_optional::<u32, D>(
4976                self.buffer_size_megabytes_hint
4977                    .as_ref()
4978                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
4979                encoder,
4980                offset + cur_offset,
4981                depth,
4982            )?;
4983
4984            _prev_end_offset = cur_offset + envelope_size;
4985            if 3 > max_ordinal {
4986                return Ok(());
4987            }
4988
4989            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4990            // are envelope_size bytes.
4991            let cur_offset: usize = (3 - 1) * envelope_size;
4992
4993            // Zero reserved fields.
4994            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4995
4996            // Safety:
4997            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4998            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4999            //   envelope_size bytes, there is always sufficient room.
5000            fidl::encoding::encode_in_envelope_optional::<u64, D>(
5001                self.start_timeout_milliseconds
5002                    .as_ref()
5003                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
5004                encoder,
5005                offset + cur_offset,
5006                depth,
5007            )?;
5008
5009            _prev_end_offset = cur_offset + envelope_size;
5010            if 4 > max_ordinal {
5011                return Ok(());
5012            }
5013
5014            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5015            // are envelope_size bytes.
5016            let cur_offset: usize = (4 - 1) * envelope_size;
5017
5018            // Zero reserved fields.
5019            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5020
5021            // Safety:
5022            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5023            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5024            //   envelope_size bytes, there is always sufficient room.
5025            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_tracing::BufferingMode, D>(
5026            self.buffering_mode.as_ref().map(<fidl_fuchsia_tracing::BufferingMode as fidl::encoding::ValueTypeMarker>::borrow),
5027            encoder, offset + cur_offset, depth
5028        )?;
5029
5030            _prev_end_offset = cur_offset + envelope_size;
5031            if 5 > max_ordinal {
5032                return Ok(());
5033            }
5034
5035            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5036            // are envelope_size bytes.
5037            let cur_offset: usize = (5 - 1) * envelope_size;
5038
5039            // Zero reserved fields.
5040            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5041
5042            // Safety:
5043            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5044            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5045            //   envelope_size bytes, there is always sufficient room.
5046            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ProviderSpec, 100>, D>(
5047            self.provider_specs.as_ref().map(<fidl::encoding::Vector<ProviderSpec, 100> as fidl::encoding::ValueTypeMarker>::borrow),
5048            encoder, offset + cur_offset, depth
5049        )?;
5050
5051            _prev_end_offset = cur_offset + envelope_size;
5052            if 6 > max_ordinal {
5053                return Ok(());
5054            }
5055
5056            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5057            // are envelope_size bytes.
5058            let cur_offset: usize = (6 - 1) * envelope_size;
5059
5060            // Zero reserved fields.
5061            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5062
5063            // Safety:
5064            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5065            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5066            //   envelope_size bytes, there is always sufficient room.
5067            fidl::encoding::encode_in_envelope_optional::<FxtVersion, D>(
5068                self.version.as_ref().map(<FxtVersion as fidl::encoding::ValueTypeMarker>::borrow),
5069                encoder,
5070                offset + cur_offset,
5071                depth,
5072            )?;
5073
5074            _prev_end_offset = cur_offset + envelope_size;
5075
5076            Ok(())
5077        }
5078    }
5079
5080    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TraceConfig {
5081        #[inline(always)]
5082        fn new_empty() -> Self {
5083            Self::default()
5084        }
5085
5086        unsafe fn decode(
5087            &mut self,
5088            decoder: &mut fidl::encoding::Decoder<'_, D>,
5089            offset: usize,
5090            mut depth: fidl::encoding::Depth,
5091        ) -> fidl::Result<()> {
5092            decoder.debug_check_bounds::<Self>(offset);
5093            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5094                None => return Err(fidl::Error::NotNullable),
5095                Some(len) => len,
5096            };
5097            // Calling decoder.out_of_line_offset(0) is not allowed.
5098            if len == 0 {
5099                return Ok(());
5100            };
5101            depth.increment()?;
5102            let envelope_size = 8;
5103            let bytes_len = len * envelope_size;
5104            let offset = decoder.out_of_line_offset(bytes_len)?;
5105            // Decode the envelope for each type.
5106            let mut _next_ordinal_to_read = 0;
5107            let mut next_offset = offset;
5108            let end_offset = offset + bytes_len;
5109            _next_ordinal_to_read += 1;
5110            if next_offset >= end_offset {
5111                return Ok(());
5112            }
5113
5114            // Decode unknown envelopes for gaps in ordinals.
5115            while _next_ordinal_to_read < 1 {
5116                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5117                _next_ordinal_to_read += 1;
5118                next_offset += envelope_size;
5119            }
5120
5121            let next_out_of_line = decoder.next_out_of_line();
5122            let handles_before = decoder.remaining_handles();
5123            if let Some((inlined, num_bytes, num_handles)) =
5124                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5125            {
5126                let member_inline_size = <fidl::encoding::Vector<
5127                    fidl::encoding::BoundedString<100>,
5128                    5000,
5129                > as fidl::encoding::TypeMarker>::inline_size(
5130                    decoder.context
5131                );
5132                if inlined != (member_inline_size <= 4) {
5133                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5134                }
5135                let inner_offset;
5136                let mut inner_depth = depth.clone();
5137                if inlined {
5138                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5139                    inner_offset = next_offset;
5140                } else {
5141                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5142                    inner_depth.increment()?;
5143                }
5144                let val_ref = self.categories.get_or_insert_with(|| {
5145                    fidl::new_empty!(
5146                        fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 5000>,
5147                        D
5148                    )
5149                });
5150                fidl::decode!(
5151                    fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 5000>,
5152                    D,
5153                    val_ref,
5154                    decoder,
5155                    inner_offset,
5156                    inner_depth
5157                )?;
5158                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5159                {
5160                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5161                }
5162                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5163                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5164                }
5165            }
5166
5167            next_offset += envelope_size;
5168            _next_ordinal_to_read += 1;
5169            if next_offset >= end_offset {
5170                return Ok(());
5171            }
5172
5173            // Decode unknown envelopes for gaps in ordinals.
5174            while _next_ordinal_to_read < 2 {
5175                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5176                _next_ordinal_to_read += 1;
5177                next_offset += envelope_size;
5178            }
5179
5180            let next_out_of_line = decoder.next_out_of_line();
5181            let handles_before = decoder.remaining_handles();
5182            if let Some((inlined, num_bytes, num_handles)) =
5183                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5184            {
5185                let member_inline_size =
5186                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5187                if inlined != (member_inline_size <= 4) {
5188                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5189                }
5190                let inner_offset;
5191                let mut inner_depth = depth.clone();
5192                if inlined {
5193                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5194                    inner_offset = next_offset;
5195                } else {
5196                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5197                    inner_depth.increment()?;
5198                }
5199                let val_ref =
5200                    self.buffer_size_megabytes_hint.get_or_insert_with(|| fidl::new_empty!(u32, D));
5201                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5202                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5203                {
5204                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5205                }
5206                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5207                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5208                }
5209            }
5210
5211            next_offset += envelope_size;
5212            _next_ordinal_to_read += 1;
5213            if next_offset >= end_offset {
5214                return Ok(());
5215            }
5216
5217            // Decode unknown envelopes for gaps in ordinals.
5218            while _next_ordinal_to_read < 3 {
5219                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5220                _next_ordinal_to_read += 1;
5221                next_offset += envelope_size;
5222            }
5223
5224            let next_out_of_line = decoder.next_out_of_line();
5225            let handles_before = decoder.remaining_handles();
5226            if let Some((inlined, num_bytes, num_handles)) =
5227                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5228            {
5229                let member_inline_size =
5230                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5231                if inlined != (member_inline_size <= 4) {
5232                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5233                }
5234                let inner_offset;
5235                let mut inner_depth = depth.clone();
5236                if inlined {
5237                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5238                    inner_offset = next_offset;
5239                } else {
5240                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5241                    inner_depth.increment()?;
5242                }
5243                let val_ref =
5244                    self.start_timeout_milliseconds.get_or_insert_with(|| fidl::new_empty!(u64, D));
5245                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
5246                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5247                {
5248                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5249                }
5250                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5251                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5252                }
5253            }
5254
5255            next_offset += envelope_size;
5256            _next_ordinal_to_read += 1;
5257            if next_offset >= end_offset {
5258                return Ok(());
5259            }
5260
5261            // Decode unknown envelopes for gaps in ordinals.
5262            while _next_ordinal_to_read < 4 {
5263                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5264                _next_ordinal_to_read += 1;
5265                next_offset += envelope_size;
5266            }
5267
5268            let next_out_of_line = decoder.next_out_of_line();
5269            let handles_before = decoder.remaining_handles();
5270            if let Some((inlined, num_bytes, num_handles)) =
5271                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5272            {
5273                let member_inline_size = <fidl_fuchsia_tracing::BufferingMode as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5274                if inlined != (member_inline_size <= 4) {
5275                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5276                }
5277                let inner_offset;
5278                let mut inner_depth = depth.clone();
5279                if inlined {
5280                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5281                    inner_offset = next_offset;
5282                } else {
5283                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5284                    inner_depth.increment()?;
5285                }
5286                let val_ref = self.buffering_mode.get_or_insert_with(|| {
5287                    fidl::new_empty!(fidl_fuchsia_tracing::BufferingMode, D)
5288                });
5289                fidl::decode!(
5290                    fidl_fuchsia_tracing::BufferingMode,
5291                    D,
5292                    val_ref,
5293                    decoder,
5294                    inner_offset,
5295                    inner_depth
5296                )?;
5297                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5298                {
5299                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5300                }
5301                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5302                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5303                }
5304            }
5305
5306            next_offset += envelope_size;
5307            _next_ordinal_to_read += 1;
5308            if next_offset >= end_offset {
5309                return Ok(());
5310            }
5311
5312            // Decode unknown envelopes for gaps in ordinals.
5313            while _next_ordinal_to_read < 5 {
5314                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5315                _next_ordinal_to_read += 1;
5316                next_offset += envelope_size;
5317            }
5318
5319            let next_out_of_line = decoder.next_out_of_line();
5320            let handles_before = decoder.remaining_handles();
5321            if let Some((inlined, num_bytes, num_handles)) =
5322                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5323            {
5324                let member_inline_size = <fidl::encoding::Vector<ProviderSpec, 100> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5325                if inlined != (member_inline_size <= 4) {
5326                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5327                }
5328                let inner_offset;
5329                let mut inner_depth = depth.clone();
5330                if inlined {
5331                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5332                    inner_offset = next_offset;
5333                } else {
5334                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5335                    inner_depth.increment()?;
5336                }
5337                let val_ref = self.provider_specs.get_or_insert_with(
5338                    || fidl::new_empty!(fidl::encoding::Vector<ProviderSpec, 100>, D),
5339                );
5340                fidl::decode!(fidl::encoding::Vector<ProviderSpec, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
5341                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5342                {
5343                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5344                }
5345                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5346                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5347                }
5348            }
5349
5350            next_offset += envelope_size;
5351            _next_ordinal_to_read += 1;
5352            if next_offset >= end_offset {
5353                return Ok(());
5354            }
5355
5356            // Decode unknown envelopes for gaps in ordinals.
5357            while _next_ordinal_to_read < 6 {
5358                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5359                _next_ordinal_to_read += 1;
5360                next_offset += envelope_size;
5361            }
5362
5363            let next_out_of_line = decoder.next_out_of_line();
5364            let handles_before = decoder.remaining_handles();
5365            if let Some((inlined, num_bytes, num_handles)) =
5366                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5367            {
5368                let member_inline_size =
5369                    <FxtVersion as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5370                if inlined != (member_inline_size <= 4) {
5371                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5372                }
5373                let inner_offset;
5374                let mut inner_depth = depth.clone();
5375                if inlined {
5376                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5377                    inner_offset = next_offset;
5378                } else {
5379                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5380                    inner_depth.increment()?;
5381                }
5382                let val_ref = self.version.get_or_insert_with(|| fidl::new_empty!(FxtVersion, D));
5383                fidl::decode!(FxtVersion, D, val_ref, decoder, inner_offset, inner_depth)?;
5384                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5385                {
5386                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5387                }
5388                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5389                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5390                }
5391            }
5392
5393            next_offset += envelope_size;
5394
5395            // Decode the remaining unknown envelopes.
5396            while next_offset < end_offset {
5397                _next_ordinal_to_read += 1;
5398                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5399                next_offset += envelope_size;
5400            }
5401
5402            Ok(())
5403        }
5404    }
5405}